diff --git a/Android/.gitignore b/Android/.gitignore new file mode 100644 index 0000000..39fb081 --- /dev/null +++ b/Android/.gitignore @@ -0,0 +1,9 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures +.externalNativeBuild diff --git a/Android/app/.gitignore b/Android/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/Android/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/Android/app/build.gradle b/Android/app/build.gradle new file mode 100644 index 0000000..f42dd37 --- /dev/null +++ b/Android/app/build.gradle @@ -0,0 +1,40 @@ +apply plugin: 'com.android.application' + +android { + signingConfigs { + } + compileSdkVersion 26 + defaultConfig { + applicationId "com.sminnovations.bookmypcr" + minSdkVersion 17 + targetSdkVersion 26 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } + buildToolsVersion '26.0.2' +} + +dependencies { + implementation fileTree(include: ['*.jar'], dir: 'libs') + implementation 'com.android.support:appcompat-v7:26.1.0' + implementation 'com.android.support:design:26.1.0' + implementation 'com.android.support.constraint:constraint-layout:1.0.2' + implementation 'com.android.support:support-v4:26.1.0' + testImplementation 'junit:junit:4.12' + androidTestImplementation 'com.android.support.test:runner:1.0.1' + androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' + compile 'com.google.firebase:firebase-core:11.8.0' + compile 'com.google.firebase:firebase-auth:11.8.0' + compile 'com.google.firebase:firebase-database:11.8.0' + compile 'com.google.firebase:firebase-invites:11.8.0' + compile 'com.firebaseui:firebase-ui-auth:3.2.2' +} + +apply plugin: 'com.google.gms.google-services' diff --git a/Android/app/google-services.json b/Android/app/google-services.json new file mode 100644 index 0000000..ea3da1f --- /dev/null +++ b/Android/app/google-services.json @@ -0,0 +1,42 @@ +{ + "project_info": { + "project_number": "1014254709438", + "firebase_url": "https://thermocycler-2bb76.firebaseio.com", + "project_id": "thermocycler-2bb76", + "storage_bucket": "thermocycler-2bb76.appspot.com" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:1014254709438:android:8d1ce0d4ef1274d7", + "android_client_info": { + "package_name": "com.sminnovations.bookmypcr" + } + }, + "oauth_client": [ + { + "client_id": "1014254709438-p1gujkoi1npcbfcolofjqmruhcvpepau.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyC4gJHT38PjxTE40_vL0mvu8hx-c2xeq8A" + } + ], + "services": { + "analytics_service": { + "status": 1 + }, + "appinvite_service": { + "status": 1, + "other_platform_oauth_client": [] + }, + "ads_service": { + "status": 2 + } + } + } + ], + "configuration_version": "1" +} diff --git a/Android/app/proguard-rules.pro b/Android/app/proguard-rules.pro new file mode 100644 index 0000000..f1b4245 --- /dev/null +++ b/Android/app/proguard-rules.pro @@ -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 diff --git a/Android/app/src/main/AndroidManifest.xml b/Android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..dd5675b --- /dev/null +++ b/Android/app/src/main/AndroidManifest.xml @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/AboutUs.java b/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/AboutUs.java new file mode 100644 index 0000000..e7f286f --- /dev/null +++ b/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/AboutUs.java @@ -0,0 +1,34 @@ +package com.sminnovations.bookmypcr.activities; + +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; +import android.support.v7.widget.Toolbar; +import android.view.MenuItem; + +import com.sminnovations.R; + +public class AboutUs extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_about_us); + Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + setSupportActionBar(toolbar); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_close_white_24dp); + this.setTitle("About Us"); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case android.R.id.home: + finish(); + onBackPressed(); + return true; + default: + return super.onOptionsItemSelected(item); + } + } +} diff --git a/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/AddPCR.java b/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/AddPCR.java new file mode 100644 index 0000000..a4f22d9 --- /dev/null +++ b/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/AddPCR.java @@ -0,0 +1,59 @@ +package com.sminnovations.bookmypcr.activities; + +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; +import android.support.v7.widget.Toolbar; +import android.view.MenuItem; +import android.view.View; +import android.widget.EditText; +import android.widget.Toast; + +import com.sminnovations.R; +import com.sminnovations.bookmypcr.pojo.AppDataClass; +import com.sminnovations.bookmypcr.pojo.Pcr; + +public class AddPCR extends AppCompatActivity { + + EditText title, manufacturer,model,location,comments; + AppDataClass appDataClass; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_add_pcr); + Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + setSupportActionBar(toolbar); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_close_white_24dp); + this.setTitle("Add PCR"); + title=(EditText)findViewById(R.id.title); + manufacturer=(EditText)findViewById(R.id.manufacturer); + model=(EditText)findViewById(R.id.model); + location=(EditText)findViewById(R.id.location); + comments=(EditText)findViewById(R.id.comments); + appDataClass = (AppDataClass) getApplicationContext(); + } + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case android.R.id.home: + finish(); + onBackPressed(); + return true; + default: + return super.onOptionsItemSelected(item); + } + } + public void savePCR(View v){ + if(title.getText().toString().trim().isEmpty()){ + Toast.makeText(AddPCR.this, + "Please enter name", + Toast.LENGTH_SHORT).show(); + return; + } + Pcr slot=new Pcr(title.getText().toString(),manufacturer.getText().toString(),appDataClass.getmDatabase().child(appDataClass.getLab().getLabuid()).push().getKey(),model.getText().toString(),location.getText().toString(),comments.getText().toString()); + appDataClass.getmDatabase().child(appDataClass.getLab().getLabuid()).child(slot.getEquipid()).setValue(slot); + finish(); + onBackPressed(); + } +} diff --git a/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/CalendarActivity.java b/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/CalendarActivity.java new file mode 100644 index 0000000..931d70e --- /dev/null +++ b/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/CalendarActivity.java @@ -0,0 +1,469 @@ +package com.sminnovations.bookmypcr.activities; + +import android.app.DatePickerDialog; +import android.content.Intent; +import android.net.Uri; +import android.os.Bundle; +import android.os.Handler; +import android.support.design.widget.FloatingActionButton; +import android.support.design.widget.Snackbar; +import android.support.v4.app.Fragment; +import android.support.v4.app.FragmentTransaction; +import android.support.v4.view.GestureDetectorCompat; +import android.support.v4.view.MenuItemCompat; +import android.view.View; +import android.support.design.widget.NavigationView; +import android.support.v4.view.GravityCompat; +import android.support.v4.widget.DrawerLayout; +import android.support.v7.app.ActionBarDrawerToggle; +import android.support.v7.app.AppCompatActivity; +import android.support.v7.widget.Toolbar; +import android.view.Menu; +import android.view.MenuItem; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.DatePicker; +import android.widget.LinearLayout; +import android.widget.ScrollView; +import android.widget.Spinner; +import android.widget.TextView; + +import com.google.android.gms.appinvite.AppInviteInvitation; +import com.google.firebase.auth.FirebaseAuth; +import com.google.firebase.database.DataSnapshot; +import com.google.firebase.database.DatabaseError; +import com.google.firebase.database.DatabaseReference; +import com.google.firebase.database.FirebaseDatabase; +import com.google.firebase.database.ValueEventListener; +import com.sminnovations.R; +import com.sminnovations.bookmypcr.fragmentHandler.DayFragment; +import com.sminnovations.bookmypcr.pojo.AppDataClass; +import com.sminnovations.bookmypcr.pojo.Booking; +import com.sminnovations.bookmypcr.pojo.Equipment; +import com.sminnovations.bookmypcr.pojo.Lab; +import com.sminnovations.bookmypcr.pojo.User; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; + +public class CalendarActivity extends AppCompatActivity + implements NavigationView.OnNavigationItemSelectedListener, DayFragment.OnFragmentInteractionListener,View.OnClickListener,AdapterView.OnItemSelectedListener { + + AppDataClass appDataClass; + private Handler mHandler; + public static String CURRENT_TAG; + int eventCode=602; + private SimpleDateFormat dateFormatter,timeFormat=new SimpleDateFormat("hh:mm a", Locale.US);; + TextView datevalue; + HashMap loadedFrag= new HashMap<>(); + Calendar newDate=Calendar.getInstance(); + private DatePickerDialog fromDatePickerDialog; + private DatabaseReference mDatabase; + ArrayList categories = new ArrayList(); + ArrayList equipmentList = new ArrayList(); + ArrayAdapter dataAdapter; + Spinner spinner; + boolean firstrun=true; + NavigationView navigationView; + + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_calendar); + Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + setSupportActionBar(toolbar); + this.setTitle("PCR Booking"); + mHandler=new Handler(); + dateFormatter = new SimpleDateFormat("dd-MM-yyyy", Locale.US); + mDatabase = FirebaseDatabase.getInstance().getReference(); + + +// mDatabase.child("emails").push().setValue(new ChildEmail("-L81IUsqJV_A8jvWPOy2","-L81KVrIM1OreB01CcZZ","pavann3008@gmail.com")); +// mDatabase.child("-L81IUsqJV_A8jvWPOy2").push().setValue("equipment1"); +// mDatabase.child("labs").addListenerForSingleValueEvent(new ValueEventListener() { +// @Override +// public void onDataChange(DataSnapshot dataSnapshot) { +// +// System.out.println(dataSnapshot.getValue().toString()); +// } +// +// @Override +// public void onCancelled(DatabaseError databaseError) { +// System.out.println("The read failed: " + databaseError.getCode()); +// } +// }); + appDataClass = (AppDataClass) getApplicationContext(); + appDataClass.setmDatabase(mDatabase); + FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); + fab.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + addEvent(); + } + }); + + DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); + ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( + this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); + drawer.addDrawerListener(toggle); + toggle.syncState(); + + navigationView = (NavigationView) findViewById(R.id.nav_view); + navigationView.setNavigationItemSelectedListener(this); + CURRENT_TAG=dateFormatter.format(Calendar.getInstance().getTime()); + datevalue=(TextView)findViewById(R.id.display_current_date); + + spinner = (Spinner) findViewById(R.id.spinner); + + // Spinner click listener + spinner.setOnItemSelectedListener(this); + + // Spinner Drop down elements + + // Creating adapter for spinner + dataAdapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, categories); + + // Drop down layout style - list view with radio button + dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + + // attaching data adapter to spinner + spinner.setAdapter(dataAdapter); + + initialize(); + setDateTimeField(); + loadHomeFragment(); + + + } + +// mDatabase.child("clubs") +// .orderByChild("name") +// .equalTo("efg") +// .addListenerForSingleValueEvent(new ValueEventListener() { +// @Override +// public void onDataChange(DataSnapshot dataSnapshot) { +// for (DataSnapshot childSnapshot: dataSnapshot.getChildren()) { +// String clubkey = childSnapshot.getKey(); + + + + private void initialize(){ + Menu nav_Menu = navigationView.getMenu(); + nav_Menu.findItem(R.id.nav_settings).setVisible(appDataClass.getChildEmail().isAdmin()); + nav_Menu.findItem(R.id.nav_addPCR).setVisible(appDataClass.getChildEmail().isAdmin()); + + mDatabase.child("labs").child(appDataClass.getChildEmail().getLabUid()).addValueEventListener(new ValueEventListener() { + @Override + public void onDataChange(DataSnapshot dataSnapshot) { + appDataClass.setLab(dataSnapshot.getValue(Lab.class)); + } + @Override + public void onCancelled(DatabaseError databaseError) { + System.out.println("The read failed: " + databaseError.getCode()); + } + }); + mDatabase.child("users").child(appDataClass.getChildEmail().getUserUid()).addValueEventListener(new ValueEventListener() { + @Override + public void onDataChange(DataSnapshot dataSnapshot) { + appDataClass.setUserObj(dataSnapshot.getValue(User.class)); + if(!appDataClass.getUserObj().isActive()) + redirectNoAccess(); + } + @Override + public void onCancelled(DatabaseError databaseError) { + System.out.println("The read failed: " + databaseError.getCode()); + } + }); + firstrun=true; + mDatabase.child(appDataClass.getChildEmail().getLabUid()).addValueEventListener(new ValueEventListener() { + @Override + public void onDataChange(DataSnapshot dataSnapshot) { + categories.clear();equipmentList.clear(); + for (DataSnapshot childSnapshot: dataSnapshot.getChildren()) { + Equipment equip=childSnapshot.getValue(Equipment.class); + categories.add(equip.getName());equipmentList.add(equip); + } + if(dataAdapter!=null) { + dataAdapter.notifyDataSetChanged(); + } + updateview(); + } + @Override + public void onCancelled(DatabaseError databaseError) { + System.out.println("The read failed: " + databaseError.getCode()); + } + }); +// mDatabase.child("labs").child("-L81IUsqJV_A8jvWPOy2").setValue(new Lab("OMI","IISc","Sai Siva Gorthi","9740137245","Malleshwaram, Bangalore","-L81IUsqJV_A8jvWPOy2")); +// mDatabase.child("users").child("-L81KVrIM1OreB01CcZZ").setValue(new User("Pavan",true,true,"-L81KVrIM1OreB01CcZZ")); +// mDatabase.child("-L81IUsqJV_A8jvWPOy2").child("-L81SR-2oc4HxRI8dYOF").setValue(new Equipment("Bio-rad","Thorlabs","-L81SR-2oc4HxRI8dYOF")); + } + + public void redirectNoAccess(){ + Intent intent = new Intent(this, NoAccess.class); + startActivity(intent); + } + + public void updateview(){ + System.out.println("Entering"+spinner.getSelectedItemPosition()); + int index; + if(spinner.getSelectedItemPosition()<0){ + index=0; + } + else{ + index=spinner.getSelectedItemPosition(); + } + mDatabase.child(equipmentList.get(index).getEquipid()).child(CURRENT_TAG).addValueEventListener(new ValueEventListener() { + @Override + public void onDataChange(DataSnapshot dataSnapshot) { + List eventList=loadedFrag.get(CURRENT_TAG).getEventList(); + eventList.clear(); + for (DataSnapshot childSnapshot: dataSnapshot.getChildren()) { + eventList.add(childSnapshot.getValue(Booking.class)); + } + loadedFrag.get(CURRENT_TAG).setEventList(eventList); + loadedFrag.get(CURRENT_TAG).notifyDataChanged(); + } + @Override + public void onCancelled(DatabaseError databaseError) { + System.out.println("The read failed: " + databaseError.getCode()); + } + }); + firstrun=false; + } + + + @Override + public void onItemSelected(AdapterView parent, View view, int position, long id) { + // On selecting a spinner item + String item = parent.getItemAtPosition(position).toString(); + loadedFrag=new HashMap<>(); + loadHomeFragment(); + // Showing selected spinner item + + } + + @Override + public void onNothingSelected(AdapterView arg0) { + // TODO Auto-generated method stub + + } + + private void setDateTimeField() { + datevalue.setOnClickListener(this); + datevalue.setText(dateFormatter.format(newDate.getTime())); + fromDatePickerDialog = new DatePickerDialog(this, new DatePickerDialog.OnDateSetListener() { + + public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { + newDate.set(year, monthOfYear, dayOfMonth); + datevalue.setText(dateFormatter.format(newDate.getTime())); + CURRENT_TAG=dateFormatter.format(newDate.getTime()); + loadHomeFragment(); + } + + }, newDate.get(Calendar.YEAR), newDate.get(Calendar.MONTH), newDate.get(Calendar.DAY_OF_MONTH)); + } + + @Override + public void onClick(View view) { + if(view == datevalue) { + fromDatePickerDialog.show(); + } + } + + + public void previousDay(View v){ + newDate.add(Calendar.DAY_OF_MONTH,-1); + datevalue.setText(dateFormatter.format(newDate.getTime())); + CURRENT_TAG=dateFormatter.format(newDate.getTime()); + fromDatePickerDialog.updateDate(newDate.get(Calendar.YEAR), newDate.get(Calendar.MONTH), newDate.get(Calendar.DAY_OF_MONTH)); + loadHomeFragment(); + + } + public void nextDay(View v){ + newDate.add(Calendar.DAY_OF_MONTH,1); + datevalue.setText(dateFormatter.format(newDate.getTime())); + CURRENT_TAG=dateFormatter.format(newDate.getTime()); + fromDatePickerDialog.updateDate(newDate.get(Calendar.YEAR), newDate.get(Calendar.MONTH), newDate.get(Calendar.DAY_OF_MONTH)); + loadHomeFragment(); + } + + public void addEvent(View v){ + Intent intent = new Intent(this, NewEvent.class); + intent.putExtra("dateSelected", datevalue.getText()); + intent.putExtra("clickid", v.getId()); + intent.putExtra("equipment", equipmentList.get(spinner.getSelectedItemPosition())); +// startActivityForResult(intent, eventCode); + startActivity(intent); + } + + public void addEvent(){ + Intent intent = new Intent(this, NewEvent.class); + intent.putExtra("dateSelected", datevalue.getText()); + intent.putExtra("equipment", equipmentList.get(spinner.getSelectedItemPosition())); + intent.putExtra("clickid", 0); + startActivity(intent); +// startActivityForResult(intent, eventCode); + } + + public void editEvent(View v)throws Exception{ + Booking slot=loadedFrag.get(CURRENT_TAG).getMapping().get((LinearLayout)v); + Intent intent; + Calendar obj=Calendar.getInstance(),obj3=Calendar.getInstance(); + obj.setTime(dateFormatter.parse(slot.getDate())); + Calendar obj2=Calendar.getInstance(); + obj2.setTime(timeFormat.parse(slot.getStartTime())); + obj.set(Calendar.HOUR_OF_DAY,obj2.get(Calendar.HOUR_OF_DAY)); + obj.set(Calendar.MINUTE,obj2.get(Calendar.MINUTE)); + if(appDataClass.getUserObj().getUseruid().equals(slot.getUserid()) && obj.compareTo(obj3)>=0 ) + intent = new Intent(this, EditEvent.class); + else + intent = new Intent(this, ViewEvent.class); + intent.putExtra("slot", slot); + intent.putExtra("equipment", equipmentList.get(spinner.getSelectedItemPosition())); + startActivity(intent); + } + + + + private void loadHomeFragment() { + +// final FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); +// if (getSupportFragmentManager().findFragmentByTag(CURRENT_TAG) != null) { +// fragmentTransaction.attach(loadedFrag.get(CURRENT_TAG)); +// return; +// } + + Runnable mPendingRunnable = new Runnable() { + @Override + public void run() { + DayFragment homeFragment=loadedFrag.get(CURRENT_TAG); + if(homeFragment==null){ + homeFragment= new DayFragment().newInstance((Calendar)newDate.clone(),appDataClass); + loadedFrag.put(CURRENT_TAG,homeFragment); + if(!firstrun){ + updateview(); + } + } + Fragment fragment = homeFragment; + FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); + fragmentTransaction.setCustomAnimations(android.R.anim.fade_in, + android.R.anim.fade_out); + fragmentTransaction.replace(R.id.frameitem, fragment, CURRENT_TAG); + fragmentTransaction.commitAllowingStateLoss(); + ScrollView targetView = (ScrollView) findViewById(R.id.scroll); + if(CURRENT_TAG.equals(dateFormatter.format(Calendar.getInstance().getTime()))) { + int hour = Calendar.getInstance().get(Calendar.HOUR_OF_DAY); + targetView.smoothScrollTo(0, hour * 90); + } + else + targetView.smoothScrollTo(0, 0); + + } + }; + + // If mPendingRunnable is not null, then add to the message queue + if (mPendingRunnable != null) { + mHandler.post(mPendingRunnable); + } + + } + @Override + public void onBackPressed() { + DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); + if (drawer.isDrawerOpen(GravityCompat.START)) { + drawer.closeDrawer(GravityCompat.START); + } else { + super.onBackPressed(); + } + } + +// @Override +// public boolean onCreateOptionsMenu(Menu menu) { +// // Inflate the menu; this adds items to the action bar if it is present. +// getMenuInflater().inflate(R.menu.calendar, menu); +// MenuItem item = menu.findItem(R.id.spinner); +// Spinner spinner = (Spinner) MenuItemCompat.getActionView(item); +// +// ArrayList contacts = new ArrayList<>(); +// contacts.add("Test 1"); +// contacts.add("Test 2"); +// +// ArrayAdapter adapter = new ArrayAdapter(getApplicationContext(), android.R.layout.simple_spinner_item, contacts); +// adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); +// spinner.setAdapter(adapter); +// +// return true; +// } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + // Handle action bar item clicks here. The action bar will + // automatically handle clicks on the Home/Up button, so long + // as you specify a parent activity in AndroidManifest.xml. + int id = item.getItemId(); + +// //noinspection SimplifiableIfStatement +// if (id == R.id.spinner) { +// return true; +// } + + return super.onOptionsItemSelected(item); + } + + @SuppressWarnings("StatementWithEmptyBody") + @Override + public boolean onNavigationItemSelected(MenuItem item) { + // Handle navigation view item clicks here. + int id = item.getItemId(); + + if (id == R.id.nav_addPCR) { + Intent intent = new Intent(this, AddPCR.class); + startActivity(intent); + } else if (id == R.id.nav_settings) { + Intent intent = new Intent(this, Settings.class); + startActivity(intent); + }else if (id == R.id.nav_invite) { + Intent intent = new AppInviteInvitation.IntentBuilder("Invitation to join PCR Booking App") + .setMessage("Welcome") +// .setCustomImage(Uri.parse(getString(R.string.invitation_custom_image))) + .setCallToActionText("Install") + .build(); +// startActivity(intent); + startActivityForResult(intent, 1); + + + }else if (id == R.id.nav_help) { + Intent intent = new Intent(this, HelpActivity.class); + startActivity(intent); + + } else if (id == R.id.nav_aboutUs) { + Intent intent = new Intent(this, AboutUs.class); + startActivity(intent); + } + else if (id == R.id.nav_signOut) { + appDataClass.getmAuth().signOut(); + appDataClass=new AppDataClass(); + appDataClass.setmAuth(FirebaseAuth.getInstance()); + Intent intent = new Intent(this, LoginActivity.class); + startActivity(intent); + } + + DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); + drawer.closeDrawer(GravityCompat.START); + return true; + } + + + + @Override + public void onFragmentInteraction(Uri uri) { + + } + +} diff --git a/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/CreateLab.java b/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/CreateLab.java new file mode 100644 index 0000000..2346eaa --- /dev/null +++ b/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/CreateLab.java @@ -0,0 +1,108 @@ +package com.sminnovations.bookmypcr.activities; + +import android.content.Intent; +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; +import android.support.v7.widget.Toolbar; +import android.view.MenuItem; +import android.view.View; +import android.widget.EditText; +import android.widget.Toast; + +import com.sminnovations.R; +import com.sminnovations.bookmypcr.pojo.AppDataClass; +import com.sminnovations.bookmypcr.pojo.ChildEmail; +import com.sminnovations.bookmypcr.pojo.Lab; +import com.sminnovations.bookmypcr.pojo.Pcr; + +public class CreateLab extends AppCompatActivity { + + EditText title, manufacturer,model,location,comments,labName,dept,univ,incharge,inchargeNo,inchargeEmail; + AppDataClass appDataClass; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_create_lab); + Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + setSupportActionBar(toolbar); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_close_white_24dp); + this.setTitle("Create a Lab Account"); + title=(EditText)findViewById(R.id.title); + manufacturer=(EditText)findViewById(R.id.manufacturer); + model=(EditText)findViewById(R.id.model); + location=(EditText)findViewById(R.id.location); + comments=(EditText)findViewById(R.id.comments); + labName=(EditText)findViewById(R.id.labName); + dept=(EditText)findViewById(R.id.department); + univ=(EditText)findViewById(R.id.university); + incharge=(EditText)findViewById(R.id.incharge); + inchargeNo=(EditText)findViewById(R.id.inchargeNo); + inchargeEmail=(EditText)findViewById(R.id.inchargeEmail); + appDataClass = (AppDataClass) getApplicationContext(); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case android.R.id.home: + finish(); + onBackPressed(); + return true; + default: + return super.onOptionsItemSelected(item); + } + } + public void createLab(View v){ + if(labName.getText().toString().trim().isEmpty()){ + Toast.makeText(CreateLab.this, + "Please enter Lab name", + Toast.LENGTH_SHORT).show(); + return; + } + if(dept.getText().toString().trim().isEmpty()){ + Toast.makeText(CreateLab.this, + "Please enter Department name", + Toast.LENGTH_SHORT).show(); + return; + } + if(univ.getText().toString().trim().isEmpty()){ + Toast.makeText(CreateLab.this, + "Please enter University name", + Toast.LENGTH_SHORT).show(); + return; + } + if(incharge.getText().toString().trim().isEmpty()){ + Toast.makeText(CreateLab.this, + "Please enter Incharge name", + Toast.LENGTH_SHORT).show(); + return; + } + if(inchargeEmail.getText().toString().trim().isEmpty()){ + Toast.makeText(CreateLab.this, + "Please enter Incharge Email ID", + Toast.LENGTH_SHORT).show(); + return; + } + if(title.getText().toString().trim().isEmpty()){ + Toast.makeText(CreateLab.this, + "Please enter PCR name", + Toast.LENGTH_SHORT).show(); + return; + } + Lab obj=new Lab(labName.getText().toString().trim(),dept.getText().toString().trim(),univ.getText().toString().trim(),incharge.getText().toString().trim(),(inchargeNo.getText().toString()),inchargeEmail.getText().toString()); + obj.setLabuid(appDataClass.getmDatabase().child("labs").push().getKey()); + appDataClass.getmDatabase().child("labs").child(obj.getLabuid()).setValue(obj); + appDataClass.setLab(obj); + Pcr slot=new Pcr(title.getText().toString(),manufacturer.getText().toString(),appDataClass.getmDatabase().child(appDataClass.getLab().getLabuid()).push().getKey(),model.getText().toString(),location.getText().toString(),comments.getText().toString()); + appDataClass.getmDatabase().child(appDataClass.getLab().getLabuid()).child(slot.getEquipid()).setValue(slot); + ChildEmail emailObj=appDataClass.getChildEmail(); + emailObj.setLabUid(obj.getLabuid()); + emailObj.setAdmin(true); + appDataClass.getmDatabase().child("emails").child(emailObj.getEmailUid()).setValue(emailObj); + appDataClass.setChildEmail(emailObj); + Intent intent = new Intent(this, CalendarActivity.class); + startActivity(intent); + } +} diff --git a/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/EditEvent.java b/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/EditEvent.java new file mode 100644 index 0000000..ce14a39 --- /dev/null +++ b/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/EditEvent.java @@ -0,0 +1,335 @@ +package com.sminnovations.bookmypcr.activities; + +import android.app.DatePickerDialog; +import android.content.Context; +import android.graphics.Point; +import android.os.Bundle; +import android.support.design.widget.CoordinatorLayout; +import android.support.v7.app.AppCompatActivity; +import android.support.v7.widget.Toolbar; +import android.view.Display; +import android.view.Gravity; +import android.view.LayoutInflater; +import android.view.MenuItem; +import android.view.View; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.Button; +import android.widget.DatePicker; +import android.widget.EditText; +import android.widget.PopupWindow; +import android.widget.RelativeLayout; +import android.widget.Spinner; +import android.widget.TextView; +import android.widget.Toast; + +import com.google.firebase.database.DataSnapshot; +import com.google.firebase.database.DatabaseError; +import com.google.firebase.database.ValueEventListener; +import com.sminnovations.R; +import com.sminnovations.bookmypcr.pojo.AppDataClass; +import com.sminnovations.bookmypcr.pojo.Booking; +import com.sminnovations.bookmypcr.pojo.Equipment; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; +import java.util.Locale; + +public class EditEvent extends AppCompatActivity implements View.OnClickListener,AdapterView.OnItemSelectedListener{ + + private Booking slot; + private Equipment equipment; + TextView fromdateView,enddateView; + EditText title, reaction,comments; + Calendar fromDate =Calendar.getInstance(), endDate =Calendar.getInstance(); + private DatePickerDialog fromDatePickerDialog,endDatePickerDialog; + private SimpleDateFormat dateFormatter, timestampFormat=new SimpleDateFormat("dd-MM-yyyy HH:mm", Locale.US), + timeFormat=new SimpleDateFormat("hh:mm a", Locale.US); + AppDataClass appDataClass; + List startSpinnerArray = new ArrayList(); + List endSpinnerArray = new ArrayList(); + ArrayAdapter startAdapter,endAdapter ; + Spinner sItems,eItems; + RelativeLayout mainLayout; + PopupWindow popupWindow; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_edit_event); + Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + setSupportActionBar(toolbar); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_close_white_24dp); + this.setTitle("Edit Event"); + Bundle extras = getIntent().getExtras(); + mainLayout = (RelativeLayout) findViewById(R.id.mainLayout); + if (extras != null) { + slot= (Booking)getIntent().getSerializableExtra("slot"); + equipment = (Equipment)getIntent().getSerializableExtra("equipment"); + } + fromdateView =(TextView)findViewById(R.id.datebar); + title=(EditText)findViewById(R.id.title); + reaction=(EditText)findViewById(R.id.reaction); + comments=(EditText)findViewById(R.id.comments); + enddateView=(TextView)findViewById(R.id.enddatebar); + dateFormatter = new SimpleDateFormat("dd-MM-yyyy", Locale.US); + appDataClass = (AppDataClass) getApplicationContext(); + startAdapter = new ArrayAdapter( + this, android.R.layout.simple_spinner_item, startSpinnerArray); + endAdapter = new ArrayAdapter( + this, android.R.layout.simple_spinner_item, endSpinnerArray); + startAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + endAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + setDateTimeField(); + + } + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case android.R.id.home: + finish(); + onBackPressed(); + return true; + default: + return super.onOptionsItemSelected(item); + } + } + + private void setDateTimeField() { + fromdateView.setOnClickListener(this); + enddateView.setOnClickListener(this); + fromdateView.setText(slot.getDate()); + enddateView.setText(slot.getDate()); + Calendar endTime=Calendar.getInstance(); + Calendar startTime=Calendar.getInstance(); + try{ + fromDate.setTime(dateFormatter.parse(slot.getDate())); + endDate.setTime(dateFormatter.parse(slot.getDate())); + endTime.setTime(timeFormat.parse(slot.getEndTime())); + endTime.setTime(timeFormat.parse(slot.getEndTime())); + endTime.set(fromDate.get(Calendar.YEAR), fromDate.get(Calendar.MONTH), fromDate.get(Calendar.DAY_OF_MONTH)); + startTime.setTime(timeFormat.parse("12:00 AM")); + }catch (ParseException e){ + e.printStackTrace(); + } + fromDatePickerDialog = new DatePickerDialog(this, new DatePickerDialog.OnDateSetListener() { + + public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { + fromDate.set(year, monthOfYear, dayOfMonth); + fromdateView.setText(dateFormatter.format(fromDate.getTime())); + } + + }, fromDate.get(Calendar.YEAR), fromDate.get(Calendar.MONTH), fromDate.get(Calendar.DAY_OF_MONTH)); + + endDatePickerDialog = new DatePickerDialog(this, new DatePickerDialog.OnDateSetListener() { + + public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { + endDate.set(year, monthOfYear, dayOfMonth); + enddateView.setText(dateFormatter.format(endDate.getTime())); + } + + }, endDate.get(Calendar.YEAR), endDate.get(Calendar.MONTH), endDate.get(Calendar.DAY_OF_MONTH)); + + title.setText(slot.getTitle()); + reaction.setText(slot.getReactionspec()); + comments.setText(slot.getComments()); + + startSpinnerArray.add(timeFormat.format(startTime.getTime())); + int startIndex=0; + for(int i=0;i<48;i++){ + startTime.add(Calendar.MINUTE,30); + startSpinnerArray.add(timeFormat.format(startTime.getTime())); + if(timeFormat.format(startTime.getTime()).equalsIgnoreCase(slot.getStartTime())){ + startIndex=i; + } + } + + for(int i=0;i<16;i++){ + endTime.add(Calendar.MINUTE,30); + if(endTime.get(Calendar.DAY_OF_MONTH)!=fromDate.get(Calendar.DAY_OF_MONTH)){ + break; + } + endSpinnerArray.add(timeFormat.format(endTime.getTime())); + } + sItems = (Spinner) findViewById(R.id.startTime); + sItems.setAdapter(startAdapter); + sItems.setSelection(startIndex+1); + sItems.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + @Override + public void onItemSelected(AdapterView arg0, View arg1, + int arg2, long arg3) { + + Calendar endTime=Calendar.getInstance(); + try { + endTime.setTime(timeFormat.parse(arg0.getSelectedItem().toString())); + endTime.set(fromDate.get(Calendar.YEAR), fromDate.get(Calendar.MONTH), fromDate.get(Calendar.DAY_OF_MONTH)); + }catch (Exception e){ + e.printStackTrace(); + } + endSpinnerArray.clear(); + for(int i=0;i<16;i++){ + endTime.add(Calendar.MINUTE,30); + if(endTime.get(Calendar.DAY_OF_MONTH)!=fromDate.get(Calendar.DAY_OF_MONTH)){ + break; + } + endSpinnerArray.add(timeFormat.format(endTime.getTime())); + endAdapter.notifyDataSetChanged(); + } + } + + @Override + public void onNothingSelected(AdapterView arg0) { + } + }); + eItems = (Spinner) findViewById(R.id.endTime); + eItems.setAdapter(endAdapter); + } + + public void saveEvent(View v){ + if (title.getText().toString().trim().isEmpty()||eItems.getSelectedItem()==null) { + Toast.makeText(EditEvent.this, + "Please enter all mandatory fields", + Toast.LENGTH_SHORT).show(); + return; + } + validate(appDataClass,sItems.getSelectedItem().toString(),eItems.getSelectedItem().toString(),fromdateView.getText().toString(),equipment); + } + + public void saveData() { + + Calendar dateTemp = Calendar.getInstance(), dateTemp2 = Calendar.getInstance(), dateTemp3 = (Calendar) dateTemp.clone(); + try { + dateTemp2.setTime(dateFormatter.parse(fromdateView.getText().toString())); + dateTemp3.setTime(timeFormat.parse(sItems.getSelectedItem().toString())); + dateTemp3.set(dateTemp2.get(Calendar.YEAR), dateTemp2.get(Calendar.MONTH), dateTemp2.get(Calendar.DAY_OF_MONTH)); + if (dateTemp3.compareTo(dateTemp) < 0) { + LayoutInflater layoutInflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + View customView = layoutInflater.inflate(R.layout.popup_confirmation, null); + Button closePopupBtn = (Button) customView.findViewById(R.id.closePopupBtn); + Button confirmPopupBtn = (Button) customView.findViewById(R.id.confirmPopupBtn); + //instantiate popup window + popupWindow = new PopupWindow(customView, CoordinatorLayout.LayoutParams.MATCH_PARENT, CoordinatorLayout.LayoutParams.WRAP_CONTENT); + popupWindow.setFocusable(true); + Display display = getWindowManager().getDefaultDisplay(); + Point size = new Point(); + display.getSize(size); + int width = size.x; + width = (int) (width - (double) width * 0.1); + popupWindow.setWidth(width); + //display the popup window + popupWindow.showAtLocation(mainLayout, Gravity.CENTER, 0, 0); + + //close the popup window on button click + closePopupBtn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + popupWindow.dismiss(); + } + }); + confirmPopupBtn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + saveDataFinal(); + popupWindow.dismiss(); + } + }); + } else { + saveDataFinal(); + } + } catch (Exception e) { + + } + } + public void saveDataFinal() { + Booking slotObj=new Booking(appDataClass.getUserObj().getUseruid(),appDataClass.getUserObj().getName(),title.getText().toString() + ,reaction.getText().toString(),comments.getText().toString(),fromdateView.getText().toString(),sItems.getSelectedItem().toString(),eItems.getSelectedItem().toString(), + timestampFormat.format(Calendar.getInstance().getTime()),slot.getKey()); + slotObj.setDuration((eItems.getSelectedItemPosition()+1)*0.5); + appDataClass.getmDatabase().child(equipment.getEquipid()).child(fromdateView.getText().toString()).child(slotObj.getKey()).setValue(slotObj); + finish(); + onBackPressed(); + + } + + public void deleteEvent(View v){ + Toast.makeText(EditEvent.this, + "Event Deleted", + Toast.LENGTH_SHORT).show(); + appDataClass.getmDatabase().child(equipment.getEquipid()).child(fromdateView.getText().toString()).child(slot.getKey()).removeValue(); + finish(); + onBackPressed(); + } + + @Override + public void onItemSelected(AdapterView parent, View view, int position, long id) { + // On selecting a spinner item + String item = parent.getItemAtPosition(position).toString(); + + // Showing selected spinner item + + } + + + @Override + public void onClick(View view) { + if(view == fromdateView) { + fromDatePickerDialog.show(); + }else if(view==enddateView){ + endDatePickerDialog.show(); + } + } + + @Override + public void onNothingSelected(AdapterView arg0) { + // TODO Auto-generated method stub + + } + + public boolean validate(AppDataClass appDataClass, String fromTime, String endtime, String date, Equipment equipment){ + final Calendar startTime=Calendar.getInstance(),toTime=(Calendar)startTime.clone(); + try { + startTime.setTime(timeFormat.parse(fromTime)); + toTime.setTime(timeFormat.parse(endtime)); + }catch (Exception e){ + + } + + appDataClass.getmDatabase().child(equipment.getEquipid()).child(date).addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(DataSnapshot dataSnapshot) { + Calendar tempStartTime=(Calendar)startTime.clone(),tempEndTime=(Calendar)startTime.clone(); + for (DataSnapshot childSnapshot: dataSnapshot.getChildren()) { + Booking slot=childSnapshot.getValue(Booking.class); + try { + tempStartTime.setTime(timeFormat.parse(slot.getStartTime())); + tempEndTime.setTime(timeFormat.parse(slot.getEndTime())); + }catch (Exception e){ + + } + if(tempStartTime.compareTo(startTime)==0 ||tempEndTime.compareTo(toTime)==0 || (tempStartTime.compareTo(startTime)>0 && tempEndTime.compareTo(toTime)<0) || (tempStartTime.compareTo(startTime)<0 && tempEndTime.compareTo(toTime)>0) + || (tempStartTime.compareTo(startTime)<0 && tempEndTime.compareTo(startTime)>0)|| (tempStartTime.compareTo(toTime)<0 && tempEndTime.compareTo(toTime)>0)) { + error(); + return; + } + } + saveData(); + } + @Override + public void onCancelled(DatabaseError databaseError) { + System.out.println("The read failed: " + databaseError.getCode()); + } + }); + return true; + } + + public void error(){ + Toast.makeText(EditEvent.this, + "System is busy in the selected time range", + Toast.LENGTH_SHORT).show(); + } + +} diff --git a/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/HelpActivity.java b/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/HelpActivity.java new file mode 100644 index 0000000..2fde79d --- /dev/null +++ b/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/HelpActivity.java @@ -0,0 +1,34 @@ +package com.sminnovations.bookmypcr.activities; + +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; +import android.support.v7.widget.Toolbar; +import android.view.MenuItem; + +import com.sminnovations.R; + +public class HelpActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_help); + Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + setSupportActionBar(toolbar); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_close_white_24dp); + this.setTitle("Help"); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case android.R.id.home: + finish(); + onBackPressed(); + return true; + default: + return super.onOptionsItemSelected(item); + } + } +} diff --git a/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/JoinLab.java b/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/JoinLab.java new file mode 100644 index 0000000..b58831f --- /dev/null +++ b/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/JoinLab.java @@ -0,0 +1,116 @@ +package com.sminnovations.bookmypcr.activities; + +import android.app.ProgressDialog; +import android.content.Intent; +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; +import android.support.v7.widget.Toolbar; +import android.view.MenuItem; +import android.view.View; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.ListView; +import android.widget.TextView; + +import com.google.firebase.database.DataSnapshot; +import com.google.firebase.database.DatabaseError; +import com.google.firebase.database.DatabaseReference; +import com.google.firebase.database.ValueEventListener; +import com.sminnovations.R; +import com.sminnovations.bookmypcr.pojo.AppDataClass; +import com.sminnovations.bookmypcr.pojo.ChildEmail; +import com.sminnovations.bookmypcr.pojo.Lab; + +import java.util.ArrayList; +import java.util.List; + +public class JoinLab extends AppCompatActivity { + + TextView searchValue; + ProgressDialog mProgress; + AppDataClass appDataClass; + ArrayAdapter adapter; + List resultValue = new ArrayList<>(); + List resultObj = new ArrayList<>(); + private DatabaseReference mDatabase; + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_join_lab); + Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + setSupportActionBar(toolbar); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_close_white_24dp); + this.setTitle("Join a Lab Account"); + appDataClass=(AppDataClass)this.getApplicationContext(); + searchValue=(TextView)findViewById(R.id.searchValue); + ListView listView1 = (ListView) findViewById(R.id.resultList); + mProgress = new ProgressDialog(this); + mProgress.setMessage("Fetching Data ..."); + adapter = new ArrayAdapter(this, + android.R.layout.simple_list_item_1, resultValue); + listView1.setAdapter(adapter); + listView1.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView adapter, View v, int position, long id) { + joinLab(position); + } + }); + mDatabase=appDataClass.getmDatabase(); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case android.R.id.home: + finish(); + onBackPressed(); + return true; + default: + return super.onOptionsItemSelected(item); + } + } + + public void search(View v){ + final String search=searchValue.getText().toString().trim().toLowerCase(); + if(search.isEmpty()) { + resultValue.clear(); + resultObj.clear(); + adapter.notifyDataSetChanged(); + return; + } + mProgress.show(); + mDatabase.child("labs").orderByChild("name").addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(DataSnapshot dataSnapshot) { + resultValue.clear(); + resultObj.clear(); + for (DataSnapshot childSnapshot: dataSnapshot.getChildren()) { + Lab obj=childSnapshot.getValue(Lab.class); + if(obj.getName().toLowerCase().contains(search)){ + resultValue.add(obj.getName()); + resultObj.add(obj); + } + } + adapter.notifyDataSetChanged(); + mProgress.hide(); + } + @Override + public void onCancelled(DatabaseError databaseError) { + mProgress.hide(); + System.out.println("The read failed: " + databaseError.getCode()); + } + }); + } + + public void joinLab(int position){ + ChildEmail emailObj=appDataClass.getChildEmail(); + emailObj.setLabUid(resultObj.get(position).getLabuid()); + mDatabase.child("emails").child(emailObj.getEmailUid()).setValue(emailObj); + appDataClass.setChildEmail(emailObj); + Intent intent = new Intent(this, CalendarActivity.class); + startActivity(intent); + } +} diff --git a/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/LoginActivity.java b/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/LoginActivity.java new file mode 100644 index 0000000..bac4b56 --- /dev/null +++ b/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/LoginActivity.java @@ -0,0 +1,544 @@ +package com.sminnovations.bookmypcr.activities; + +import android.animation.Animator; +import android.animation.AnimatorListenerAdapter; +import android.annotation.TargetApi; +import android.content.Intent; +import android.content.pm.PackageManager; +import android.os.Handler; +import android.support.annotation.NonNull; +import android.support.design.widget.Snackbar; +import android.support.v7.app.AppCompatActivity; +import android.app.LoaderManager.LoaderCallbacks; + +import android.content.CursorLoader; +import android.content.Loader; +import android.database.Cursor; +import android.net.Uri; +import android.os.AsyncTask; + +import android.os.Build; +import android.os.Bundle; +import android.provider.ContactsContract; +import android.text.TextUtils; +import android.view.KeyEvent; +import android.view.View; +import android.view.View.OnClickListener; +import android.view.inputmethod.EditorInfo; +import android.widget.ArrayAdapter; +import android.widget.AutoCompleteTextView; +import android.widget.Button; +import android.widget.EditText; +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; +import com.google.firebase.auth.UserProfileChangeRequest; +import com.google.firebase.database.DataSnapshot; +import com.google.firebase.database.DatabaseError; +import com.google.firebase.database.DatabaseReference; +import com.google.firebase.database.FirebaseDatabase; +import com.google.firebase.database.ValueEventListener; +import com.sminnovations.R; + +import java.util.ArrayList; +import java.util.List; + +import com.sminnovations.bookmypcr.pojo.AppDataClass; +import com.sminnovations.bookmypcr.pojo.ChildEmail; +import com.sminnovations.bookmypcr.pojo.User; + +import static android.Manifest.permission.READ_CONTACTS; + +/** + * A login screen that offers login via email/password. + */ +public class LoginActivity extends AppCompatActivity implements LoaderCallbacks { + + /** + * Id to identity READ_CONTACTS permission request. + */ + private static final int REQUEST_READ_CONTACTS = 0; + + /** + * A dummy authentication store containing known user names and passwords. + * TODO: remove after connecting to a real authentication system. + */ + private static final String[] DUMMY_CREDENTIALS = new String[]{ + "foo@example.com:hello", "bar@example.com:world" + }; + /** + * Keep track of the login task to ensure we can cancel it if requested. + */ + private UserLoginTask mAuthTask = null; + + // UI references. + private AutoCompleteTextView mEmailView; + private EditText mPasswordView; + private View mProgressView; + private View mLoginFormView; + private FirebaseAuth mAuth; + private AppDataClass appDataClass; + private Handler handler = new Handler(); + private DatabaseReference mDatabase; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_login); + // Set up the login form. + mEmailView = (AutoCompleteTextView) findViewById(R.id.email); + populateAutoComplete(); + + mPasswordView = (EditText) findViewById(R.id.password); + mPasswordView.setOnEditorActionListener(new TextView.OnEditorActionListener() { + @Override + public boolean onEditorAction(TextView textView, int id, KeyEvent keyEvent) { + if (id == EditorInfo.IME_ACTION_DONE || id == EditorInfo.IME_NULL) { + attemptLogin(); + return true; + } + return false; + } + }); + + Button mEmailSignInButton = (Button) findViewById(R.id.email_sign_in_button); + mEmailSignInButton.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View view) { + attemptLogin(); + } + }); + appDataClass = (AppDataClass) getApplicationContext(); + mAuth=appDataClass.getmAuth(); + mLoginFormView = findViewById(R.id.login_form); + mProgressView = findViewById(R.id.login_progress); + } + + private void populateAutoComplete() { + if (!mayRequestContacts()) { + return; + } + + getLoaderManager().initLoader(0, null, this); + } + + private boolean mayRequestContacts() { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { + return true; + } + if (checkSelfPermission(READ_CONTACTS) == PackageManager.PERMISSION_GRANTED) { + return true; + } + if (shouldShowRequestPermissionRationale(READ_CONTACTS)) { + Snackbar.make(mEmailView, R.string.permission_rationale, Snackbar.LENGTH_INDEFINITE) + .setAction(android.R.string.ok, new View.OnClickListener() { + @Override + @TargetApi(Build.VERSION_CODES.M) + public void onClick(View v) { + requestPermissions(new String[]{READ_CONTACTS}, REQUEST_READ_CONTACTS); + } + }); + } else { + requestPermissions(new String[]{READ_CONTACTS}, REQUEST_READ_CONTACTS); + } + return false; + } + + /** + * Callback received when a permissions request has been completed. + */ + @Override + public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, + @NonNull int[] grantResults) { + if (requestCode == REQUEST_READ_CONTACTS) { + if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { + populateAutoComplete(); + } + } + } + + + /** + * Attempts to sign in or register the account specified by the login form. + * If there are form errors (invalid email, missing fields, etc.), the + * errors are presented and no actual login attempt is made. + */ + private void attemptLogin() { + if (mAuthTask != null) { + return; + } + + // Reset errors. + mEmailView.setError(null); + mPasswordView.setError(null); + + // Store values at the time of the login attempt. + String email = mEmailView.getText().toString(); + String password = mPasswordView.getText().toString(); + + boolean cancel = false; + View focusView = null; + + // Check for a valid password, if the user entered one. + if (!TextUtils.isEmpty(password) && !isPasswordValid(password)) { + mPasswordView.setError(getString(R.string.error_invalid_password)); + focusView = mPasswordView; + cancel = true; + } + + // Check for a valid email address. + if (TextUtils.isEmpty(email)) { + mEmailView.setError(getString(R.string.error_field_required)); + focusView = mEmailView; + cancel = true; + } else if (!isEmailValid(email)) { + mEmailView.setError(getString(R.string.error_invalid_email)); + focusView = mEmailView; + cancel = true; + } + + if (cancel) { + // There was an error; don't attempt login and focus the first + // form field with an error. + focusView.requestFocus(); + } else { + // Show a progress spinner, and kick off a background task to + // perform the user login attempt. + showProgress(true); + + mAuth.signInWithEmailAndPassword(email, password) + .addOnCompleteListener(this, new OnCompleteListener() { + @Override + public void onComplete(@NonNull Task task) { + if (task.isSuccessful()) { + // Sign in success, update UI with the signed-in user's information +// Log.d(TAG, "signInWithEmail:success"); + final FirebaseUser user = mAuth.getCurrentUser(); + callCalendar(user); +// updateUI(user); + } else { + // If sign in fails, display a message to the user. + Toast.makeText(LoginActivity.this, "Authentication failed.", + Toast.LENGTH_SHORT).show(); + showMessage("Failed"); + showProgress(false); +// updateUI(null); + } + + // ... + } + }); + +// mAuthTask = new UserLoginTask(email, password); +// mAuthTask.execute((Void) null); + } + } + +// private void sendEmailVerification() { +// // Disable button +// findViewById(R.id.verify_email_button).setEnabled(false); +// +// // Send verification email +// // [START send_email_verification] +// final FirebaseUser user = mAuth.getCurrentUser(); +// user.sendEmailVerification() +// .addOnCompleteListener(this, new OnCompleteListener() { +// @Override +// public void onComplete(@NonNull Task task) { +// // [START_EXCLUDE] +// // Re-enable button +// findViewById(R.id.verify_email_button).setEnabled(true); +// +// if (task.isSuccessful()) { +// Toast.makeText(EmailPasswordActivity.this, +// "Verification email sent to " + user.getEmail(), +// Toast.LENGTH_SHORT).show(); +// } else { +// Log.e(TAG, "sendEmailVerification", task.getException()); +// Toast.makeText(EmailPasswordActivity.this, +// "Failed to send verification email.", +// Toast.LENGTH_SHORT).show(); +// } +// // [END_EXCLUDE] +// } +// }); +// // [END send_email_verification] +// } + + private void callCalendar(final FirebaseUser user) { + if(user.isEmailVerified()) { + + appDataClass.setUser(user); + mDatabase = FirebaseDatabase.getInstance().getReference(); + appDataClass.setmDatabase(mDatabase); + mDatabase.child("emails").orderByChild("emailid").equalTo(user.getEmail()).addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(DataSnapshot dataSnapshot) { + for (DataSnapshot childSnapshot: dataSnapshot.getChildren()) { + appDataClass.setChildEmail(childSnapshot.getValue(ChildEmail.class)); + } + navigation(user); + } + @Override + public void onCancelled(DatabaseError databaseError) { + System.out.println("The read failed: " + databaseError.getCode()); + } + }); + } + else{ + showProgress(false); + user.sendEmailVerification() + .addOnCompleteListener(this, new OnCompleteListener() { + @Override + public void onComplete(@NonNull Task task) { + // Re-enable button + + if (task.isSuccessful()) { + Toast.makeText(LoginActivity.this, + "Email not verified. Verification email sent to " + user.getEmail(), + Toast.LENGTH_SHORT).show(); + } else { + Toast.makeText(LoginActivity.this, + "Email not verified. Failed to send verification email.", + Toast.LENGTH_SHORT).show(); + } + } + }); + } + + } + + private boolean isEmailValid(String email) { + //TODO: Replace this with your own logic + return email.contains("@"); + } + + private boolean isPasswordValid(String password) { + //TODO: Replace this with your own logic + return password.length() > 4; + } + + private void navigation(FirebaseUser user){ + if(appDataClass.getChildEmail()==null){ + Toast.makeText(LoginActivity.this, + "First time login. We are setting up your account. Please wait.", + Toast.LENGTH_SHORT).show(); + User userObj= new User(user.getDisplayName(),true,false,user.getUid()); + mDatabase.child("users").child(user.getUid()).setValue(userObj); + ChildEmail emailObj=new ChildEmail("",user.getUid(),user.getEmail(),mDatabase.child("emails").push().getKey()); + mDatabase.child("emails").child(emailObj.getEmailUid()).setValue(emailObj); + appDataClass.setChildEmail(emailObj); + } + else if(appDataClass.getChildEmail().userUid==null ||appDataClass.getChildEmail().userUid.isEmpty()) { + User userObj= new User(user.getDisplayName(),true,false,user.getUid()); + mDatabase.child("users").child(user.getUid()).setValue(userObj); + appDataClass.getChildEmail().setUserUid(user.getUid()); + mDatabase.child("emails").child(appDataClass.getChildEmail().getEmailUid()).setValue(appDataClass.getChildEmail()); + } + if(appDataClass.getChildEmail().labUid==null ||appDataClass.getChildEmail().labUid.isEmpty()){ + Intent intent = new Intent(this, NoAccess.class); + startActivity(intent); + }else { + Intent intent = new Intent(this, CalendarActivity.class); + startActivity(intent); + } + } + + @Override + public void onBackPressed() { + + } + /** + * Shows the progress UI and hides the login form. + */ + @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2) + private void showProgress(final boolean show) { + // On Honeycomb MR2 we have the ViewPropertyAnimator APIs, which allow + // for very easy animations. If available, use these APIs to fade-in + // the progress spinner. + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) { + int shortAnimTime = getResources().getInteger(android.R.integer.config_shortAnimTime); + + mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE); + mLoginFormView.animate().setDuration(shortAnimTime).alpha( + show ? 0 : 1).setListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE); + } + }); + + mProgressView.setVisibility(show ? View.VISIBLE : View.GONE); + mProgressView.animate().setDuration(shortAnimTime).alpha( + show ? 1 : 0).setListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + mProgressView.setVisibility(show ? View.VISIBLE : View.GONE); + } + }); + } else { + // The ViewPropertyAnimator APIs are not available, so simply show + // and hide the relevant UI components. + mProgressView.setVisibility(show ? View.VISIBLE : View.GONE); + mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE); + } + } + + @Override + public Loader onCreateLoader(int i, Bundle bundle) { + return new CursorLoader(this, + // Retrieve data rows for the device user's 'profile' contact. + Uri.withAppendedPath(ContactsContract.Profile.CONTENT_URI, + ContactsContract.Contacts.Data.CONTENT_DIRECTORY), ProfileQuery.PROJECTION, + + // Select only email addresses. + ContactsContract.Contacts.Data.MIMETYPE + + " = ?", new String[]{ContactsContract.CommonDataKinds.Email + .CONTENT_ITEM_TYPE}, + + // Show primary email addresses first. Note that there won't be + // a primary email address if the user hasn't specified one. + ContactsContract.Contacts.Data.IS_PRIMARY + " DESC"); + } + + @Override + public void onLoadFinished(Loader cursorLoader, Cursor cursor) { + List emails = new ArrayList<>(); + cursor.moveToFirst(); + while (!cursor.isAfterLast()) { + emails.add(cursor.getString(ProfileQuery.ADDRESS)); + cursor.moveToNext(); + } + + addEmailsToAutoComplete(emails); + } + + public void newUser(View v){ + Intent intent = new Intent(this, NewUser.class); + startActivity(intent); + } + + public void resetPassword(View v){ + Intent intent = new Intent(this, ResetPassword.class); + startActivity(intent); + } + + @Override + public void onLoaderReset(Loader cursorLoader) { + + } + + private void addEmailsToAutoComplete(List emailAddressCollection) { + //Create adapter to tell the AutoCompleteTextView what to show in its dropdown list. + ArrayAdapter adapter = + new ArrayAdapter<>(LoginActivity.this, + android.R.layout.simple_dropdown_item_1line, emailAddressCollection); + + mEmailView.setAdapter(adapter); + } + + + private interface ProfileQuery { + String[] PROJECTION = { + ContactsContract.CommonDataKinds.Email.ADDRESS, + ContactsContract.CommonDataKinds.Email.IS_PRIMARY, + }; + + int ADDRESS = 0; + int IS_PRIMARY = 1; + } + + /** + * Represents an asynchronous login/registration task used to authenticate + * the user. + */ + public class UserLoginTask extends AsyncTask { + + private final String mEmail; + private final String mPassword; + + UserLoginTask(String email, String password) { + mEmail = email; + mPassword = password; + } + + @Override + protected Boolean doInBackground(Void... params) { + // TODO: attempt authentication against a network service. + + try { +// mAuth.signInWithEmailAndPassword(mEmail, mPassword) +// .addOnCompleteListener(this, new OnCompleteListener() { +// @Override +// public void onComplete(@NonNull Task task) { +// if (task.isSuccessful()) { +// // Sign in success, update UI with the signed-in user's information +//// Log.d(TAG, "signInWithEmail:success"); +// FirebaseUser user = mAuth.getCurrentUser(); +//// updateUI(user); +// } else { +// // If sign in fails, display a message to the user. +// Log.w(TAG, "signInWithEmail:failure", task.getException()); +// Toast.makeText(LoginActivity.this, "Authentication failed.", +// Toast.LENGTH_SHORT).show(); +//// updateUI(null); +// } +// +// // ... +// } +// }); + Thread.sleep(2000); + } catch (InterruptedException e) { + return false; + } + + for (String credential : DUMMY_CREDENTIALS) { + String[] pieces = credential.split(":"); + if (pieces[0].equals(mEmail)) { + // Account exists, return true if the password matches. + return pieces[1].equals(mPassword); + } + } + + // TODO: register the new account here. + return true; + } + + @Override + protected void onPostExecute(final Boolean success) { + mAuthTask = null; + showProgress(false); + + if (success) { + finish(); + } else { + mPasswordView.setError(getString(R.string.error_incorrect_password)); + mPasswordView.requestFocus(); + } + } + + @Override + protected void onCancelled() { + mAuthTask = null; + showProgress(false); + } + } + + public void showMessage(final String message) { + + handler.post(new Runnable() { + public void run() { + Toast.makeText(getApplicationContext(), message, Toast.LENGTH_LONG).show(); + } + }); + + } + + +} + diff --git a/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/NewEvent.java b/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/NewEvent.java new file mode 100644 index 0000000..307c215 --- /dev/null +++ b/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/NewEvent.java @@ -0,0 +1,350 @@ +package com.sminnovations.bookmypcr.activities; + +import android.app.DatePickerDialog; +import android.content.Context; +import android.graphics.Point; +import android.os.Bundle; +import android.support.design.widget.CoordinatorLayout; +import android.support.v7.app.AppCompatActivity; +import android.support.v7.widget.Toolbar; +import android.view.Display; +import android.view.Gravity; +import android.view.LayoutInflater; +import android.view.MenuItem; +import android.view.View; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.Button; +import android.widget.DatePicker; +import android.widget.EditText; +import android.widget.PopupWindow; +import android.widget.RelativeLayout; +import android.widget.Spinner; +import android.widget.TextView; +import android.widget.Toast; + +import com.google.firebase.database.DataSnapshot; +import com.google.firebase.database.DatabaseError; +import com.google.firebase.database.ValueEventListener; +import com.sminnovations.R; +import com.sminnovations.bookmypcr.pojo.AppDataClass; +import com.sminnovations.bookmypcr.pojo.Booking; +import com.sminnovations.bookmypcr.pojo.Equipment; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; +import java.util.Locale; + +public class NewEvent extends AppCompatActivity implements View.OnClickListener,AdapterView.OnItemSelectedListener { + + private String selectedDate; + private String clickId=""; + TextView fromdateView,enddateView; + EditText title, reaction,comments; + Calendar fromDate =Calendar.getInstance(), endDate =Calendar.getInstance(); + private DatePickerDialog fromDatePickerDialog,endDatePickerDialog; + private SimpleDateFormat dateFormatter, timestampFormat=new SimpleDateFormat("dd-MM-yyyy HH:mm", Locale.US) + ,timeFormat=new SimpleDateFormat("hh:mm a", Locale.US); + private Equipment equipment; + AppDataClass appDataClass; + List startSpinnerArray = new ArrayList(); + List endSpinnerArray = new ArrayList(); + ArrayAdapter startAdapter,endAdapter ; + Spinner sItems,eItems; + RelativeLayout mainLayout; + PopupWindow popupWindow; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_new_event); + Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + this.setTitle("New Event"); + setSupportActionBar(toolbar); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_close_white_24dp); + Bundle extras = getIntent().getExtras(); + mainLayout = (RelativeLayout) findViewById(R.id.mainLayout); + if (extras != null) { + selectedDate = extras.getString("dateSelected"); + int id=extras.getInt("clickid"); + if(id==0){ + Calendar temp=Calendar.getInstance(); + temp.set(Calendar.MINUTE,0); + clickId=timeFormat.format(temp.getTime()); + }else { + clickId = getResources().getResourceName(extras.getInt("clickid")); + clickId = clickId.substring(clickId.indexOf('_') + 1, clickId.lastIndexOf('_')).toUpperCase(); + if (clickId.length() == 3) { + clickId = "0" + clickId; + clickId = clickId.substring(0, clickId.length() - 2) + ":00 " + clickId.substring(clickId.length() - 2); + } else if (clickId.length() == 4) { + clickId = clickId.substring(0, clickId.length() - 2) + ":00 " + clickId.substring(clickId.length() - 2); + } else if (clickId.length() == 6) { + clickId = "0" + clickId; + clickId = clickId.replace(".", ":"); + clickId = clickId.substring(0, clickId.length() - 2) + " " + clickId.substring(clickId.length() - 2); + } else if (clickId.length() == 7) { + clickId = clickId.replace(".", ":"); + clickId = clickId.substring(0, clickId.length() - 2) + " " + clickId.substring(clickId.length() - 2); + } + } + + + equipment = (Equipment)getIntent().getSerializableExtra("equipment"); + } + + fromdateView =(TextView)findViewById(R.id.datebar); + title=(EditText)findViewById(R.id.title); + reaction=(EditText)findViewById(R.id.reaction); + comments=(EditText)findViewById(R.id.comments); + enddateView=(TextView)findViewById(R.id.enddatebar); + dateFormatter = new SimpleDateFormat("dd-MM-yyyy", Locale.US); + appDataClass = (AppDataClass) getApplicationContext(); + startAdapter = new ArrayAdapter( + this, android.R.layout.simple_spinner_item, startSpinnerArray); + endAdapter = new ArrayAdapter( + this, android.R.layout.simple_spinner_item, endSpinnerArray); + startAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + endAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + setDateTimeField(); + + } + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case android.R.id.home: + finish(); + onBackPressed(); + return true; + default: + return super.onOptionsItemSelected(item); + } + } + + private void setDateTimeField() { + fromdateView.setOnClickListener(this); + enddateView.setOnClickListener(this); + fromdateView.setText(selectedDate); + enddateView.setText(selectedDate); + Calendar endTime=Calendar.getInstance(); + Calendar startTime=Calendar.getInstance(); + try{ + fromDate.setTime(dateFormatter.parse(selectedDate)); + endDate.setTime(dateFormatter.parse(selectedDate)); + endTime.setTime(timeFormat.parse(clickId)); + endTime.set(fromDate.get(Calendar.YEAR), fromDate.get(Calendar.MONTH), fromDate.get(Calendar.DAY_OF_MONTH)); + startTime.setTime(timeFormat.parse("12:00 AM")); + }catch (ParseException e){ + e.printStackTrace(); + } + fromDatePickerDialog = new DatePickerDialog(this, new DatePickerDialog.OnDateSetListener() { + + public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { + fromDate.set(year, monthOfYear, dayOfMonth); + fromdateView.setText(dateFormatter.format(fromDate.getTime())); + } + + }, fromDate.get(Calendar.YEAR), fromDate.get(Calendar.MONTH), fromDate.get(Calendar.DAY_OF_MONTH)); + + endDatePickerDialog = new DatePickerDialog(this, new DatePickerDialog.OnDateSetListener() { + + public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { + endDate.set(year, monthOfYear, dayOfMonth); + enddateView.setText(dateFormatter.format(endDate.getTime())); + } + + }, endDate.get(Calendar.YEAR), endDate.get(Calendar.MONTH), endDate.get(Calendar.DAY_OF_MONTH)); + + +// startSpinnerArray.add(clickId); +// startSpinnerArray.add("item2"); + startSpinnerArray.add(timeFormat.format(startTime.getTime())); + int startIndex=0; + for(int i=0;i<48;i++){ + startTime.add(Calendar.MINUTE,30); + startSpinnerArray.add(timeFormat.format(startTime.getTime())); + if(timeFormat.format(startTime.getTime()).equalsIgnoreCase(clickId)){ + startIndex=i; + } + } + + for(int i=0;i<16;i++){ + endTime.add(Calendar.MINUTE,30); + if(endTime.get(Calendar.DAY_OF_MONTH)!=fromDate.get(Calendar.DAY_OF_MONTH)){ + break; + } + endSpinnerArray.add(timeFormat.format(endTime.getTime())); + } + sItems = (Spinner) findViewById(R.id.startTime); + sItems.setAdapter(startAdapter); + sItems.setSelection(startIndex+1); + sItems.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + @Override + public void onItemSelected(AdapterView arg0, View arg1, + int arg2, long arg3) { + + Calendar endTime=Calendar.getInstance(); + try { + endTime.setTime(timeFormat.parse(arg0.getSelectedItem().toString())); + endTime.set(fromDate.get(Calendar.YEAR), fromDate.get(Calendar.MONTH), fromDate.get(Calendar.DAY_OF_MONTH)); + }catch (Exception e){ + e.printStackTrace(); + } + endSpinnerArray.clear(); + for(int i=0;i<16;i++){ + endTime.add(Calendar.MINUTE,30); + if(endTime.get(Calendar.DAY_OF_MONTH)!=fromDate.get(Calendar.DAY_OF_MONTH)){ + break; + } + endSpinnerArray.add(timeFormat.format(endTime.getTime())); + endAdapter.notifyDataSetChanged(); + } + } + + @Override + public void onNothingSelected(AdapterView arg0) { + } + }); + eItems = (Spinner) findViewById(R.id.endTime); + eItems.setAdapter(endAdapter); + } + + @Override + public void onItemSelected(AdapterView parent, View view, int position, long id) { + // On selecting a spinner item + String item = parent.getItemAtPosition(position).toString(); + + // Showing selected spinner item + + } + + public void saveEvent(View v){ + if (title.getText().toString().trim().isEmpty()||eItems.getSelectedItem()==null) { + Toast.makeText(NewEvent.this, + "Please enter all mandatory fields", + Toast.LENGTH_SHORT).show(); + return; + } + + + validate(appDataClass,sItems.getSelectedItem().toString(),eItems.getSelectedItem().toString(),fromdateView.getText().toString(),equipment); + } + + public void saveData() { + Calendar dateTemp=Calendar.getInstance(), dateTemp2=Calendar.getInstance(), dateTemp3=(Calendar)dateTemp.clone(); + try { + dateTemp2.setTime(dateFormatter.parse(fromdateView.getText().toString())); + dateTemp3.setTime(timeFormat.parse(sItems.getSelectedItem().toString())); + dateTemp3.set(dateTemp2.get(Calendar.YEAR), dateTemp2.get(Calendar.MONTH), dateTemp2.get(Calendar.DAY_OF_MONTH)); + if (dateTemp3.compareTo(dateTemp)<0) { + LayoutInflater layoutInflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + View customView = layoutInflater.inflate(R.layout.popup_confirmation, null); + Button closePopupBtn = (Button) customView.findViewById(R.id.closePopupBtn); + Button confirmPopupBtn = (Button) customView.findViewById(R.id.confirmPopupBtn); + //instantiate popup window + popupWindow = new PopupWindow(customView, CoordinatorLayout.LayoutParams.MATCH_PARENT, CoordinatorLayout.LayoutParams.WRAP_CONTENT); + popupWindow.setFocusable(true); + Display display = getWindowManager().getDefaultDisplay(); + Point size = new Point(); + display.getSize(size); + int width = size.x; + width=(int)(width-(double)width*0.1); + popupWindow.setWidth(width); + //display the popup window + popupWindow.showAtLocation(mainLayout, Gravity.CENTER, 0, 0); + + //close the popup window on button click + closePopupBtn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + popupWindow.dismiss(); + } + }); + confirmPopupBtn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + saveDataFinal(); + popupWindow.dismiss(); + } + }); + } + else{ + saveDataFinal(); + } + } catch (Exception e) { + + } + } + public void saveDataFinal(){ + + Booking slot=new Booking(appDataClass.getUserObj().getUseruid(),appDataClass.getUserObj().getName(),title.getText().toString() + ,reaction.getText().toString(),comments.getText().toString(),fromdateView.getText().toString(),sItems.getSelectedItem().toString(),eItems.getSelectedItem().toString(), + timestampFormat.format(Calendar.getInstance().getTime()),appDataClass.getmDatabase().child(equipment.getEquipid()).child(fromdateView.getText().toString()).push().getKey()); + slot.setDuration((eItems.getSelectedItemPosition()+1)*0.5); + appDataClass.getmDatabase().child(equipment.getEquipid()).child(fromdateView.getText().toString()).child(slot.getKey()).setValue(slot); + finish(); + onBackPressed(); + } + @Override + public void onClick(View view) { + if(view == fromdateView) { + fromDatePickerDialog.show(); + }else if(view==enddateView){ + endDatePickerDialog.show(); + } + } + + @Override + public void onNothingSelected(AdapterView arg0) { + // TODO Auto-generated method stub + + } + + public boolean validate(AppDataClass appDataClass, String fromTime, String endtime, String date, Equipment equipment){ + final Calendar startTime=Calendar.getInstance(),toTime=(Calendar)startTime.clone(); + try { + startTime.setTime(timeFormat.parse(fromTime)); + toTime.setTime(timeFormat.parse(endtime)); + }catch (Exception e){ + + } + + appDataClass.getmDatabase().child(equipment.getEquipid()).child(date).addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(DataSnapshot dataSnapshot) { + Calendar tempStartTime=(Calendar)startTime.clone(),tempEndTime=(Calendar)startTime.clone(); + for (DataSnapshot childSnapshot: dataSnapshot.getChildren()) { + Booking slot=childSnapshot.getValue(Booking.class); + try { + tempStartTime.setTime(timeFormat.parse(slot.getStartTime())); + tempEndTime.setTime(timeFormat.parse(slot.getEndTime())); + }catch (Exception e){ + + } + if(tempStartTime.compareTo(startTime)==0 ||tempEndTime.compareTo(toTime)==0 || (tempStartTime.compareTo(startTime)>0 && tempEndTime.compareTo(toTime)<0) || (tempStartTime.compareTo(startTime)<0 && tempEndTime.compareTo(toTime)>0) + || (tempStartTime.compareTo(startTime)<0 && tempEndTime.compareTo(startTime)>0)|| (tempStartTime.compareTo(toTime)<0 && tempEndTime.compareTo(toTime)>0)) { + error(); + return; + } + } + saveData(); + } + @Override + public void onCancelled(DatabaseError databaseError) { + System.out.println("The read failed: " + databaseError.getCode()); + } + }); + return true; + } + + public void error(){ + Toast.makeText(NewEvent.this, + "System is busy in the selected time range", + Toast.LENGTH_SHORT).show(); + } + +} diff --git a/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/NewUser.java b/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/NewUser.java new file mode 100644 index 0000000..91e99aa --- /dev/null +++ b/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/NewUser.java @@ -0,0 +1,149 @@ +package com.sminnovations.bookmypcr.activities; + +import android.support.annotation.NonNull; +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; +import android.support.v7.widget.Toolbar; +import android.text.TextUtils; +import android.util.Log; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; +import android.widget.ProgressBar; +import android.widget.Toast; + +import com.firebase.ui.auth.IdpResponse; +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.EmailAuthProvider; +import com.google.firebase.auth.FirebaseAuth; +import com.google.firebase.auth.FirebaseUser; +import com.google.firebase.auth.UserProfileChangeRequest; +import com.sminnovations.R; +import com.sminnovations.bookmypcr.pojo.AppDataClass; + +public class NewUser extends AppCompatActivity { + + private AppDataClass appDataClass; + private FirebaseAuth auth; + private Button btnSignUp; + private ProgressBar progressBar; + + private EditText inputEmail,inputPassword,confirmPassword,name; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_new_user); + Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + this.setTitle("Register"); + setSupportActionBar(toolbar); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_close_white_24dp); + appDataClass = (AppDataClass) getApplicationContext(); + auth = appDataClass.getmAuth(); + btnSignUp = (Button) findViewById(R.id.sign_up_button); + inputEmail = (EditText) findViewById(R.id.email); + inputPassword = (EditText) findViewById(R.id.password); + confirmPassword = (EditText) findViewById(R.id.confirmpassword); + name= (EditText) findViewById(R.id.name); + progressBar = (ProgressBar) findViewById(R.id.progressBar); +// btnResetPassword = (Button) findViewById(R.id.btn_reset_password); + +// btnResetPassword.setOnClickListener(new View.OnClickListener() { +// @Override +// public void onClick(View v) { +// startActivity(new Intent(SignupActivity.this, ResetPasswordActivity.class)); +// } +// }); + + + btnSignUp.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + String email = inputEmail.getText().toString().trim(); + String password = inputPassword.getText().toString().trim(); + String name2 = name.getText().toString().trim(); + String confirmpassword = confirmPassword.getText().toString().trim(); + + if (TextUtils.isEmpty(name2)) { + Toast.makeText(getApplicationContext(), "Enter name!", Toast.LENGTH_SHORT).show(); + return; + } + + if (TextUtils.isEmpty(email)) { + Toast.makeText(getApplicationContext(), "Enter email address!", Toast.LENGTH_SHORT).show(); + return; + } + + if (TextUtils.isEmpty(password)) { + Toast.makeText(getApplicationContext(), "Enter password!", Toast.LENGTH_SHORT).show(); + return; + } + + if (password.length() < 6) { + Toast.makeText(getApplicationContext(), "Password too short, enter minimum 6 characters!", Toast.LENGTH_SHORT).show(); + return; + } + + if (!password.equals(confirmpassword) ) { + Toast.makeText(getApplicationContext(), "Password and Confirm Password do not match", Toast.LENGTH_SHORT).show(); + return; + } + + progressBar.setVisibility(View.VISIBLE); + +// mHandler.startSignIn(new IdpResponse.Builder( +// new User.Builder(EmailAuthProvider.PROVIDER_ID, email) +// .setName(name) +// .build()) +// .build(), +// password); + + //create user + auth.createUserWithEmailAndPassword(email, password) + .addOnCompleteListener(NewUser.this, new OnCompleteListener() { + @Override + public void onComplete(@NonNull Task task) { + progressBar.setVisibility(View.GONE); + // If sign in fails, display a message to the user. If sign in succeeds + // the auth state listener will be notified and logic to handle the + // signed in user can be handled in the listener. + if (!task.isSuccessful()) { + Toast.makeText(NewUser.this, "Authentication failed." + task.getException(), + Toast.LENGTH_SHORT).show(); + } else { +// startActivity(new Intent(SignupActivity.this, MainActivity.class)); + updateUserName(FirebaseAuth.getInstance().getCurrentUser()); + } + } + }); + + } + }); + } + + public void updateUserName(FirebaseUser user) { + UserProfileChangeRequest profileUpdates = new UserProfileChangeRequest.Builder() + .setDisplayName(name.getText().toString()) + .build(); + + user.updateProfile(profileUpdates) + .addOnCompleteListener(new OnCompleteListener() { + @Override + public void onComplete(@NonNull Task task) { + if (task.isSuccessful()) { + Log.d("NewUser", "User profile updated."); + } + finish(); + } + }); + } + @Override + protected void onResume() { + super.onResume(); + progressBar.setVisibility(View.GONE); + } + +} diff --git a/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/NoAccess.java b/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/NoAccess.java new file mode 100644 index 0000000..73c9365 --- /dev/null +++ b/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/NoAccess.java @@ -0,0 +1,40 @@ +package com.sminnovations.bookmypcr.activities; + +import android.content.Intent; +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; +import android.view.View; + +import com.google.firebase.auth.FirebaseAuth; +import com.sminnovations.R; +import com.sminnovations.bookmypcr.pojo.AppDataClass; + +public class NoAccess extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_no_access); + } + @Override + public void onBackPressed() { + + } + + public void signOut(View v){ + AppDataClass appDataClass=(AppDataClass)this.getApplicationContext(); + appDataClass.getmAuth().signOut(); + appDataClass=new AppDataClass(); + appDataClass.setmAuth(FirebaseAuth.getInstance()); + Intent intent = new Intent(this, LoginActivity.class); + startActivity(intent); + } + public void createLab(View v){ + Intent intent = new Intent(this, CreateLab.class); + startActivity(intent); + } + public void joinLab(View v){ + Intent intent = new Intent(this, JoinLab.class); + startActivity(intent); + } +} diff --git a/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/ResetPassword.java b/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/ResetPassword.java new file mode 100644 index 0000000..4f39b7e --- /dev/null +++ b/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/ResetPassword.java @@ -0,0 +1,64 @@ +package com.sminnovations.bookmypcr.activities; + +import android.support.annotation.NonNull; +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; +import android.support.v7.widget.Toolbar; +import android.text.TextUtils; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; +import android.widget.Toast; + +import com.google.android.gms.tasks.OnCompleteListener; +import com.google.android.gms.tasks.Task; +import com.google.firebase.auth.FirebaseAuth; +import com.sminnovations.R; +import com.sminnovations.bookmypcr.pojo.AppDataClass; + +public class ResetPassword extends AppCompatActivity { + + private AppDataClass appDataClass; + private FirebaseAuth auth; + private Button btnReset; + private EditText inputEmail; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_reset_password); + Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + this.setTitle("Reset Password"); + setSupportActionBar(toolbar); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_close_white_24dp); + appDataClass = (AppDataClass) getApplicationContext(); + auth = appDataClass.getmAuth(); + btnReset = (Button) findViewById(R.id.reset_button); + inputEmail = (EditText) findViewById(R.id.email); + btnReset.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + String email = inputEmail.getText().toString().trim(); + + if (TextUtils.isEmpty(email)) { + Toast.makeText(getApplicationContext(), "Enter email address!", Toast.LENGTH_SHORT).show(); + return; + } + + auth.sendPasswordResetEmail(email) + .addOnCompleteListener(new OnCompleteListener() { + @Override + public void onComplete(@NonNull Task task) { + if (task.isSuccessful()) { + Toast.makeText(ResetPassword.this, "Check email to reset your password!", Toast.LENGTH_SHORT).show(); + finish(); + } else { + Toast.makeText(ResetPassword.this, "Fail to send reset password email!", Toast.LENGTH_SHORT).show(); + } + } + }); + } + }); + } +} diff --git a/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/Settings.java b/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/Settings.java new file mode 100644 index 0000000..ab623bc --- /dev/null +++ b/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/Settings.java @@ -0,0 +1,230 @@ +package com.sminnovations.bookmypcr.activities; + +import android.content.Context; +import android.graphics.Point; +import android.support.design.widget.CoordinatorLayout; +import android.support.design.widget.Snackbar; +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; +import android.support.v7.widget.Toolbar; +import android.view.Display; +import android.view.Gravity; +import android.view.LayoutInflater; +import android.view.MenuItem; +import android.view.View; +import android.widget.AdapterView; +import android.widget.Button; +import android.widget.CheckBox; +import android.widget.EditText; +import android.widget.ListView; +import android.widget.PopupWindow; +import android.widget.RelativeLayout; +import android.widget.Toast; + +import com.google.firebase.database.DataSnapshot; +import com.google.firebase.database.DatabaseError; +import com.google.firebase.database.ValueEventListener; +import com.sminnovations.R; +import com.sminnovations.bookmypcr.adapter.CustomAdapter; +import com.sminnovations.bookmypcr.pojo.AppDataClass; +import com.sminnovations.bookmypcr.pojo.ChildEmail; +import com.sminnovations.bookmypcr.pojo.DataModel; + +import java.util.ArrayList; + +public class Settings extends AppCompatActivity implements AdapterView.OnItemClickListener { + + AppDataClass appDataClass; + EditText labName; + ListView listView; + private static CustomAdapter adapter; + ArrayList dataModels=new ArrayList<>(); + RelativeLayout mainLayout; + PopupWindow popupWindow; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_settings); + Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + this.setTitle("Settings"); + setSupportActionBar(toolbar); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_close_white_24dp); + mainLayout = (RelativeLayout) findViewById(R.id.mainLayout); + appDataClass=(AppDataClass)this.getApplicationContext(); + labName=(EditText)findViewById(R.id.editLabName); + labName.setText(appDataClass.getLab().getName()); + listView=(ListView)findViewById(R.id.listView1); + adapter= new CustomAdapter(dataModels,getApplicationContext()); + listView.setAdapter(adapter); + listView.setOnItemClickListener(this); + initialize(); + } + + public void saveLab(View v){ + if(labName.getText().toString().trim().isEmpty()){ + Toast.makeText(Settings.this, + "Lab name can not be empty", + Toast.LENGTH_SHORT).show(); + return; + } + appDataClass.getLab().setName(labName.getText().toString()); + appDataClass.getmDatabase().child("labs").child(appDataClass.getLab().getLabuid()).setValue(appDataClass.getLab()); + Toast.makeText(Settings.this, + "Saved", + Toast.LENGTH_SHORT).show(); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case android.R.id.home: + finish(); + onBackPressed(); + return true; + default: + return super.onOptionsItemSelected(item); + } + } + + public void addPopup(View v){ + + LayoutInflater layoutInflater = (LayoutInflater) Settings.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + View customView = layoutInflater.inflate(R.layout.popup, null); + Button closePopupBtn = (Button) customView.findViewById(R.id.closePopupBtn); + Button confirmPopupBtn = (Button) customView.findViewById(R.id.confirmPopupBtn); + final EditText emailid = (EditText) customView.findViewById(R.id.emailid); + + //instantiate popup window + popupWindow = new PopupWindow(customView, CoordinatorLayout.LayoutParams.MATCH_PARENT, CoordinatorLayout.LayoutParams.WRAP_CONTENT); + popupWindow.setFocusable(true); + Display display = getWindowManager().getDefaultDisplay(); + Point size = new Point(); + display.getSize(size); + int width = size.x; + width=(int)(width-(double)width*0.1); + popupWindow.setWidth(width); + //display the popup window + popupWindow.showAtLocation(mainLayout, Gravity.CENTER, 0, 0); + + //close the popup window on button click + closePopupBtn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + popupWindow.dismiss(); + } + }); + confirmPopupBtn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + appDataClass.getmDatabase().child("emails").orderByChild("emailid").equalTo(emailid.getText().toString()).addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(DataSnapshot dataSnapshot) { + boolean flag=false; + for (DataSnapshot childSnapshot: dataSnapshot.getChildren()) { + ChildEmail obj=childSnapshot.getValue(ChildEmail.class); + obj.setLabUid(appDataClass.getLab().getLabuid()); + appDataClass.getmDatabase().child("emails").child(obj.getEmailUid()).setValue(obj); + flag=true; + } + if(!flag){ + ChildEmail obj=new ChildEmail(appDataClass.getLab().getLabuid(),"",emailid.getText().toString(),appDataClass.getmDatabase().child("emails").push().getKey()); + appDataClass.getmDatabase().child("emails").child(obj.getEmailUid()).setValue(obj); + } + } + @Override + public void onCancelled(DatabaseError databaseError) { + System.out.println("The read failed: " + databaseError.getCode()); + } + }); + ArrayList temp=(ArrayList)dataModels.clone(); + temp.add(new DataModel(emailid.getText().toString(),false)); + dataModels.clear(); + dataModels.addAll(temp); + adapter.notifyDataSetChanged(); + popupWindow.dismiss(); + } + }); + } + + + public void initialize(){ + appDataClass.getmDatabase().child("emails").orderByChild("labUid").equalTo(appDataClass.getLab().getLabuid()).addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(DataSnapshot dataSnapshot) { + for (DataSnapshot childSnapshot: dataSnapshot.getChildren()) { + ChildEmail obj=childSnapshot.getValue(ChildEmail.class); + dataModels.add(new DataModel(obj.getEmailid(),obj.isAdmin())); + } + adapter.notifyDataSetChanged(); + } + @Override + public void onCancelled(DatabaseError databaseError) { + System.out.println("The read failed: " + databaseError.getCode()); + } + }); + } + + @Override + public void onItemClick(AdapterView adapterView, View view, final int position, long l) { + long viewId = view.getId(); + + if (viewId == R.id.remove) { + + appDataClass.getmDatabase().child("emails").orderByChild("emailid").equalTo(dataModels.get(position).getEmailId()).addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(DataSnapshot dataSnapshot) { + for (DataSnapshot childSnapshot: dataSnapshot.getChildren()) { + ChildEmail obj=childSnapshot.getValue(ChildEmail.class); + obj.setLabUid(""); + appDataClass.getmDatabase().child("emails").child(obj.getEmailUid()).setValue(obj); + break; + } + } + @Override + public void onCancelled(DatabaseError databaseError) { + System.out.println("The read failed: " + databaseError.getCode()); + } + }); + ArrayList temp=(ArrayList)dataModels.clone(); + temp.remove(position); + dataModels.clear(); + dataModels.addAll(temp); + adapter.notifyDataSetChanged(); + + } else if (viewId == R.id.checkBox) { + + final CheckBox temp=(CheckBox)view; + appDataClass.getmDatabase().child("emails").orderByChild("emailid").equalTo(dataModels.get(position).getEmailId()).addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(DataSnapshot dataSnapshot) { + for (DataSnapshot childSnapshot: dataSnapshot.getChildren()) { + ChildEmail obj=childSnapshot.getValue(ChildEmail.class); + if(temp.isChecked()){ + obj.setAdmin(true); + } + else{ + obj.setAdmin(false); + } + appDataClass.getmDatabase().child("emails").child(obj.getEmailUid()).setValue(obj); + break; + } + } + @Override + public void onCancelled(DatabaseError databaseError) { + System.out.println("The read failed: " + databaseError.getCode()); + } + }); + if(temp.isChecked()){ + Toast.makeText(this, "Admin rights granted", Toast.LENGTH_SHORT).show(); + + } + else{ + Toast.makeText(this, "Admin rights revoked", Toast.LENGTH_SHORT).show(); + + } + + } + } +} diff --git a/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/SignUp.java b/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/SignUp.java new file mode 100644 index 0000000..f185150 --- /dev/null +++ b/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/SignUp.java @@ -0,0 +1,64 @@ +package com.sminnovations.bookmypcr.activities; + +import android.os.Handler; +import android.support.annotation.NonNull; +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; +import android.view.View; +import android.widget.AutoCompleteTextView; +import android.widget.EditText; + +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; +import com.sminnovations.bookmypcr.pojo.AppDataClass; +import com.sminnovations.R; + +public class SignUp extends AppCompatActivity { + + + private AutoCompleteTextView mEmailView; + private EditText mPasswordView; + private View mProgressView; + private View mLoginFormView; + private FirebaseAuth mAuth; + private AppDataClass appDataClass; + private Handler handler = new Handler(); + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_sign_up); + } + + private void createUser(){ +// mAuth.createUserWithEmailAndPassword(email, password) +// .addOnCompleteListener(this, new OnCompleteListener() { +// @Override +// public void onComplete(@NonNull Task task) { +// if (task.isSuccessful()) { +// FirebaseUser user = mAuth.getCurrentUser(); +// +// } else { +// +// } +// +// // ... +// } +// }); +// mAuth.sendPasswordResetEmail(emailAddress) +// .addOnCompleteListener(new OnCompleteListener() { +// @Override +// public void onComplete(@NonNull Task task) { +// if (task.isSuccessful()) { +// // do something when mail was sent successfully. +// } else { +// // ... +// } +// } +// }); + } +} diff --git a/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/SplashActivity.java b/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/SplashActivity.java new file mode 100644 index 0000000..0b897f1 --- /dev/null +++ b/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/SplashActivity.java @@ -0,0 +1,111 @@ +package com.sminnovations.bookmypcr.activities; + +import android.content.Context; +import android.content.Intent; +import android.net.ConnectivityManager; +import android.net.NetworkInfo; +import android.os.Bundle; +import android.support.v7.app.AppCompatActivity; +import android.widget.Toast; + +import com.google.firebase.FirebaseApp; +import com.google.firebase.auth.FirebaseAuth; +import com.google.firebase.auth.FirebaseUser; + +import com.google.firebase.database.DataSnapshot; +import com.google.firebase.database.DatabaseError; +import com.google.firebase.database.DatabaseReference; +import com.google.firebase.database.FirebaseDatabase; +import com.google.firebase.database.ValueEventListener; +import com.sminnovations.bookmypcr.pojo.AppDataClass; +import com.sminnovations.bookmypcr.pojo.ChildEmail; +import com.sminnovations.bookmypcr.pojo.User; + +public class SplashActivity extends AppCompatActivity { + + static final int REQUEST_GOOGLE_PLAY_SERVICES = 1002; + static final int REQUEST_PERMISSION_GET_ACCOUNTS = 1003; + private static final String PREF_ACCOUNT_NAME = "accountName"; + private FirebaseAuth mAuth; + private DatabaseReference mDatabase; + private AppDataClass appDataClass; + private FirebaseUser user=null; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + FirebaseApp.initializeApp(this); + if(!isDeviceOnline()){ + Toast.makeText(SplashActivity.this, + "No Internet Connection", + Toast.LENGTH_SHORT).show(); + } + mAuth = FirebaseAuth.getInstance(); + user = mAuth.getCurrentUser(); + appDataClass = (AppDataClass) getApplicationContext(); + appDataClass.setmAuth(mAuth); + if(user==null|| !user.isEmailVerified()) { + + Intent intent = new Intent(this, LoginActivity.class); + startActivity(intent); + } + else{ + appDataClass.setUser(user); + mDatabase = FirebaseDatabase.getInstance().getReference(); + appDataClass.setmDatabase(mDatabase); + mDatabase.child("emails").orderByChild("emailid").equalTo(user.getEmail()).addListenerForSingleValueEvent(new ValueEventListener() { + @Override + public void onDataChange(DataSnapshot dataSnapshot) { + for (DataSnapshot childSnapshot: dataSnapshot.getChildren()) { + appDataClass.setChildEmail(childSnapshot.getValue(ChildEmail.class)); + } + navigation(); + } + @Override + public void onCancelled(DatabaseError databaseError) { + System.out.println("The read failed: " + databaseError.getCode()); + } + }); + + + } + } + + private void navigation(){ + if(appDataClass.getChildEmail()==null){ + Toast.makeText(SplashActivity.this, + "First time login. We are setting up your account. Please wait.", + Toast.LENGTH_SHORT).show(); + User userObj= new User(user.getDisplayName(),true,false,user.getUid()); + mDatabase.child("users").child(user.getUid()).setValue(userObj); + ChildEmail emailObj=new ChildEmail("",user.getUid(),user.getEmail(),mDatabase.child("emails").push().getKey()); + mDatabase.child("emails").child(emailObj.getEmailUid()).setValue(emailObj); + appDataClass.setChildEmail(emailObj); + } + else if(appDataClass.getChildEmail().userUid==null ||appDataClass.getChildEmail().userUid.isEmpty()) { + User userObj= new User(user.getDisplayName(),true,false,user.getUid()); + mDatabase.child("users").child(user.getUid()).setValue(userObj); + appDataClass.getChildEmail().setUserUid(user.getUid()); + mDatabase.child("emails").child(appDataClass.getChildEmail().getEmailUid()).setValue(appDataClass.getChildEmail()); + } + if(appDataClass.getChildEmail().labUid==null ||appDataClass.getChildEmail().labUid.isEmpty()){ + Intent intent = new Intent(this, NoAccess.class); + startActivity(intent); + }else { + Intent intent = new Intent(this, CalendarActivity.class); + startActivity(intent); + } + } + + private boolean isDeviceOnline() { + ConnectivityManager connMgr = + (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); + NetworkInfo networkInfo = connMgr.getActiveNetworkInfo(); + return (networkInfo != null && networkInfo.isConnected()); + } + + @Override + public void onResume() { + super.onResume(); + } + +} diff --git a/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/ViewEvent.java b/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/ViewEvent.java new file mode 100644 index 0000000..02b907b --- /dev/null +++ b/Android/app/src/main/java/com/sminnovations/bookmypcr/activities/ViewEvent.java @@ -0,0 +1,71 @@ +package com.sminnovations.bookmypcr.activities; + +import android.os.Bundle; +import android.support.design.widget.FloatingActionButton; +import android.support.design.widget.Snackbar; +import android.support.v7.app.AppCompatActivity; +import android.support.v7.widget.Toolbar; +import android.view.MenuItem; +import android.widget.TextView; + +import com.sminnovations.R; +import com.sminnovations.bookmypcr.pojo.AppDataClass; +import com.sminnovations.bookmypcr.pojo.Booking; +import com.sminnovations.bookmypcr.pojo.Equipment; + +public class ViewEvent extends AppCompatActivity { + + private Booking slot; + private Equipment equipment; + TextView fromdateView,enddateView,title, reaction,comments,endTime,startTime; + AppDataClass appDataClass; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_view_event); + Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + setSupportActionBar(toolbar); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_close_white_24dp); + this.setTitle("View Event"); + Bundle extras = getIntent().getExtras(); + if (extras != null) { + slot= (Booking)getIntent().getSerializableExtra("slot"); + equipment = (Equipment)getIntent().getSerializableExtra("equipment"); + } + fromdateView =(TextView)findViewById(R.id.datebar); + title=(TextView)findViewById(R.id.title); + reaction=(TextView)findViewById(R.id.reaction); + comments=(TextView)findViewById(R.id.comments); + enddateView=(TextView)findViewById(R.id.enddatebar); + endTime=(TextView)findViewById(R.id.endTime); + startTime=(TextView)findViewById(R.id.startTime); + appDataClass = (AppDataClass) getApplicationContext(); + + setDateTimeField(); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case android.R.id.home: + finish(); + onBackPressed(); + return true; + default: + return super.onOptionsItemSelected(item); + } + } + + private void setDateTimeField() { + fromdateView.setText(slot.getDate()); + enddateView.setText(slot.getDate()); + title.setText(slot.getTitle()); + reaction.setText(slot.getReactionspec()); + comments.setText(slot.getComments()); + endTime.setText(slot.getEndTime()); + startTime.setText(slot.getStartTime()); + } + +} diff --git a/Android/app/src/main/java/com/sminnovations/bookmypcr/adapter/CustomAdapter.java b/Android/app/src/main/java/com/sminnovations/bookmypcr/adapter/CustomAdapter.java new file mode 100644 index 0000000..e923fdd --- /dev/null +++ b/Android/app/src/main/java/com/sminnovations/bookmypcr/adapter/CustomAdapter.java @@ -0,0 +1,85 @@ +package com.sminnovations.bookmypcr.adapter; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ArrayAdapter; +import android.widget.CheckBox; +import android.widget.ImageView; +import android.widget.ListView; +import android.widget.TextView; + +import com.sminnovations.R; +import com.sminnovations.bookmypcr.pojo.DataModel; + +import java.util.ArrayList; + +/** + * Created by Pavan on 23-Apr-18. + */ + +public class CustomAdapter extends ArrayAdapter { + + private ArrayList dataSet; + Context mContext; + + // View lookup cache + private static class ViewHolder { + TextView txtName; + CheckBox admin; + ImageView remove; + + } + + public CustomAdapter(ArrayList data, Context context) { + super(context, R.layout.row_item, data); + this.dataSet = data; + this.mContext=context; + + } + + @Override + public View getView(final int position, View convertView, final ViewGroup parent) { + // Get the data item for this position + DataModel dataModel = getItem(position); + // Check if an existing view is being reused, otherwise inflate the view + ViewHolder viewHolder; // view lookup cache stored in tag + + final View result; + + if (convertView == null) { + + viewHolder = new ViewHolder(); + LayoutInflater inflater = LayoutInflater.from(getContext()); + convertView = inflater.inflate(R.layout.row_item, parent, false); + viewHolder.txtName = (TextView) convertView.findViewById(R.id.email); + viewHolder.admin = (CheckBox) convertView.findViewById(R.id.checkBox); + viewHolder.remove=(ImageView)convertView.findViewById(R.id.remove); + + result=convertView; + + convertView.setTag(viewHolder); + } else { + viewHolder = (ViewHolder) convertView.getTag(); + result=convertView; + } + + viewHolder.txtName.setText(dataModel.getEmailId()); + viewHolder.admin.setChecked(dataModel.isAdmin()); + viewHolder.remove.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + ((ListView) parent).performItemClick(v, position, 0); // Let the event be handled in onItemClick() + } + }); + viewHolder.admin.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + ((ListView) parent).performItemClick(v, position, 0); // Let the event be handled in onItemClick() + } + }); + // Return the completed view to render on screen + return convertView; + } +} \ No newline at end of file diff --git a/Android/app/src/main/java/com/sminnovations/bookmypcr/fragmentHandler/DayFragment.java b/Android/app/src/main/java/com/sminnovations/bookmypcr/fragmentHandler/DayFragment.java new file mode 100644 index 0000000..3ca4e53 --- /dev/null +++ b/Android/app/src/main/java/com/sminnovations/bookmypcr/fragmentHandler/DayFragment.java @@ -0,0 +1,201 @@ +package com.sminnovations.bookmypcr.fragmentHandler; + +import android.content.Context; +import android.net.Uri; +import android.os.Bundle; +import android.support.v4.app.Fragment; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.LinearLayout; +import android.widget.RelativeLayout; +import android.widget.TextView; + +import com.sminnovations.R; +import com.sminnovations.bookmypcr.pojo.AppDataClass; +import com.sminnovations.bookmypcr.pojo.Booking; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Random; + +/** + * A simple {@link Fragment} subclass. + * Activities that contain this fragment must implement the + * {@link DayFragment.OnFragmentInteractionListener} interface + * to handle interaction events. + * Use the {@link DayFragment#newInstance} factory method to + * create an instance of this fragment. + */ +public class DayFragment extends Fragment { + + private static final String ARG_PARAM1 = "param1"; + private static final String ARG_PARAM2 = "param2"; + + private Calendar date; + private AppDataClass appDataClass; + private RelativeLayout realtiveView; + private List eventList= new ArrayList(); + private Map mapping= new HashMap<>(); + View v; + + private OnFragmentInteractionListener mListener; + SimpleDateFormat timeFormatter = new SimpleDateFormat("hh:mm a",Locale.US); + SimpleDateFormat hourFormatter = new SimpleDateFormat("hh,mm a",Locale.US); + public DayFragment() { + // Required empty public constructor + } + + public List getEventList() { + return eventList; + } + + public void setEventList(List eventList) { + this.eventList = eventList; + } + + /** + * Use this factory method to create a new instance of + * this fragment using the provided parameters. + * +// * @param param1 Parameter 1. +// * @param param2 Parameter 2. + * @return A new instance of fragment DayFragment. + */ + // TODO: Rename and change types and number of parameters + public static DayFragment newInstance(Calendar date, AppDataClass appDataClass) { + DayFragment fragment = new DayFragment(); + + fragment.setDate(date); + fragment.setAppDataClass(appDataClass); + + return fragment; + } + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + + if(v==null) { + v = inflater.inflate(R.layout.item_frame, container, false); + realtiveView = (RelativeLayout) v.findViewById(R.id.realtiveViewID); + + } +// if(!eventList.isEmpty()) +// notifyDataChanged(); + return v; + } + + @Override + public void onDestroyView() { + if (v.getParent() != null) { + ((ViewGroup)v.getParent()).removeView(v); + } + super.onDestroyView(); + } + + // TODO: Rename method, update argument and hook method into UI event + public void onButtonPressed(Uri uri) { + if (mListener != null) { + mListener.onFragmentInteraction(uri); + } + } + + @Override + public void onAttach(Context context) { + super.onAttach(context); + if (context instanceof OnFragmentInteractionListener) { + mListener = (OnFragmentInteractionListener) context; + } else { + throw new RuntimeException(context.toString() + + " must implement OnFragmentInteractionListener"); + } + } + + public void notifyDataChanged(){ + Map mappingtemp= new HashMap<>(); + for(Booking slot:eventList){ + if(!mapping.values().contains(slot)){ + mappingtemp.put(addComponent(slot),slot); + } + } + for(LinearLayout layout:mapping.keySet()){ + if(!mappingtemp.containsKey(layout)){ + realtiveView.removeView(layout); + } + } + mapping.clear(); + mapping.putAll(mappingtemp); + } + + @Override + public void onDetach() { + super.onDetach(); + mListener = null; + } + + public interface OnFragmentInteractionListener { + // TODO: Update argument type and name + void onFragmentInteraction(Uri uri); + } + + private LinearLayout addComponent(Booking slot){ + + final float scale = getContext().getResources().getDisplayMetrics().density; + int pixels = (int) (60 * scale + 0.5f); + double eventHeight=(slot.getDuration())*pixels/2; + int[] androidColors = getResources().getIntArray(R.array.androidcolors); + int randomAndroidColor = androidColors[new Random().nextInt(androidColors.length)]; + RelativeLayout.LayoutParams p = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); + String name=slot.getStartTime(); + if(name.contains(":00")){ + name=name.replaceAll(":00",""); + } + name=name.replaceAll(":",".").replaceAll("\\s","").toLowerCase(); + name=(name.startsWith("0"))?name.replaceFirst("0",""):name; + int resourceId = getContext().getResources().getIdentifier("time_"+name+"_click", "id","com.thermalcycler"); + TextView test=(TextView)realtiveView.findViewById(resourceId); + LinearLayout myText = (LinearLayout)getLayoutInflater().inflate(R.layout.tvtemplate, null); +// myText.setClickable(slot.getUserid().equals(appDataClass.getUserObj().getUseruid())); +// myText.setText("Dummy"); + myText.setBackgroundColor(randomAndroidColor); + ((TextView)myText.findViewById(R.id.tvTemplate)).setText(slot.getUsername()); + ((TextView)myText.findViewById(R.id.tvTemplate)).setHeight((int)eventHeight); + ((TextView)myText.findViewById(R.id.moredetails)).setText(slot.getTitle()+","+slot.getReactionspec()); + ((TextView)myText.findViewById(R.id.moredetails)).setHeight((int)eventHeight); + p.addRule(RelativeLayout.ALIGN_TOP, resourceId ); + p.addRule(RelativeLayout.ALIGN_START, resourceId); + realtiveView.addView(myText,p); + return myText; + } + + public Calendar getDate() { + return date; + } + + public void setDate(Calendar date) { + this.date = date; + } + + public AppDataClass getAppDataClass() { + return appDataClass; + } + + public void setAppDataClass(AppDataClass appDataClass) { + this.appDataClass = appDataClass; + } + + public Map getMapping() { + return mapping; + } +} diff --git a/Android/app/src/main/java/com/sminnovations/bookmypcr/pojo/AppDataClass.java b/Android/app/src/main/java/com/sminnovations/bookmypcr/pojo/AppDataClass.java new file mode 100644 index 0000000..18c36a4 --- /dev/null +++ b/Android/app/src/main/java/com/sminnovations/bookmypcr/pojo/AppDataClass.java @@ -0,0 +1,75 @@ +package com.sminnovations.bookmypcr.pojo; + +import android.app.Application; + +import com.google.firebase.auth.FirebaseAuth; +import com.google.firebase.auth.FirebaseUser; +import com.google.firebase.database.DatabaseReference; + +/** + * Created by Pavan on 08-Mar-18. + */ + +public class AppDataClass extends Application { + + private FirebaseAuth mAuth; + + private FirebaseUser user; + + private ChildEmail childEmail; + + private Lab lab; + + private User userObj; + + private DatabaseReference mDatabase; + + public DatabaseReference getmDatabase() { + return mDatabase; + } + + public void setmDatabase(DatabaseReference mDatabase) { + this.mDatabase = mDatabase; + } + + public FirebaseAuth getmAuth() { + return mAuth; + } + + public void setmAuth(FirebaseAuth mAuth) { + this.mAuth = mAuth; + } + + public FirebaseUser getUser() { + return user; + } + + public void setUser(FirebaseUser user) { + this.user = user; + } + + public ChildEmail getChildEmail() { + return childEmail; + } + + public void setChildEmail(ChildEmail childEmail) { + this.childEmail = childEmail; + } + + public Lab getLab() { + return lab; + } + + public void setLab(Lab lab) { + this.lab = lab; + } + + public User getUserObj() { + return userObj; + } + + public void setUserObj(User userObj) { + this.userObj = userObj; + } +} + diff --git a/Android/app/src/main/java/com/sminnovations/bookmypcr/pojo/Booking.java b/Android/app/src/main/java/com/sminnovations/bookmypcr/pojo/Booking.java new file mode 100644 index 0000000..0360c05 --- /dev/null +++ b/Android/app/src/main/java/com/sminnovations/bookmypcr/pojo/Booking.java @@ -0,0 +1,145 @@ +package com.sminnovations.bookmypcr.pojo; + +import com.google.firebase.database.IgnoreExtraProperties; + +import java.io.Serializable; +import java.util.Calendar; + +/** + * Created by Pavan on 20-Mar-18. + */ +@IgnoreExtraProperties +public class Booking implements Serializable { + + private String userid; + private String username; + private String title; + private String reactionspec; + private double duration; + private String comments; + private String date; + private String bookedDate; + private Calendar startTimeCal,endTimeCal; + private String startTime,endTime; + private String key; + + public Booking(String userid, String username, String title, String reactionspec, String comments, String date, String startTime, String endTime,String bookedDate,String key) { + this.userid = userid; + this.username = username; + this.title = title; + this.reactionspec = reactionspec; + this.comments = comments; + this.date = date; + this.startTime = startTime; + this.endTime = endTime; + this.bookedDate=bookedDate; + this.key=key; + } + + public Booking() { + } + + public String getUserid() { + return userid; + } + + public void setUserid(String userid) { + this.userid = userid; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getReactionspec() { + return reactionspec; + } + + public void setReactionspec(String reactionspec) { + this.reactionspec = reactionspec; + } + + public double getDuration() { + return duration; + } + + public void setDuration(double duration) { + this.duration = duration; + } + + public String getComments() { + return comments; + } + + public void setComments(String comments) { + this.comments = comments; + } + + public Calendar getStartTimeCal() { + return startTimeCal; + } + + public void setStartTimeCal(Calendar startTimeCal) { + this.startTimeCal = startTimeCal; + } + + public Calendar getEndTimeCal() { + return endTimeCal; + } + + public void setEndTimeCal(Calendar endTimeCal) { + this.endTimeCal = endTimeCal; + } + + public String getStartTime() { + return startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getDate() { + return date; + } + + public void setDate(String date) { + this.date = date; + } + + public String getBookedDate() { + return bookedDate; + } + + public void setBookedDate(String bookedDate) { + this.bookedDate = bookedDate; + } + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } +} diff --git a/Android/app/src/main/java/com/sminnovations/bookmypcr/pojo/ChildEmail.java b/Android/app/src/main/java/com/sminnovations/bookmypcr/pojo/ChildEmail.java new file mode 100644 index 0000000..b4bc13c --- /dev/null +++ b/Android/app/src/main/java/com/sminnovations/bookmypcr/pojo/ChildEmail.java @@ -0,0 +1,68 @@ +package com.sminnovations.bookmypcr.pojo; + +import com.google.firebase.database.IgnoreExtraProperties; + +/** + * Created by Pavan on 20-Mar-18. + */ +@IgnoreExtraProperties +public class ChildEmail { + + public String labUid; + public String userUid; + public String emailid; + public String emailUid; + public boolean admin; + + public ChildEmail(String labUid, String userUid, String emailid,String emailUid) { + this.labUid = labUid; + this.userUid = userUid; + this.emailid= emailid; + this.emailUid=emailUid; + } + + public ChildEmail() { + } + + public String getLabUid() { + return labUid; + } + + public void setLabUid(String labUid) { + this.labUid = labUid; + } + + public String getUserUid() { + return userUid; + } + + public void setUserUid(String userUid) { + this.userUid = userUid; + } + + public String getEmailid() { + return emailid; + } + + public void setEmailid(String emailid) { + this.emailid = emailid; + } + + public String getEmailUid() { + return emailUid; + } + + public void setEmailUid(String emailUid) { + this.emailUid = emailUid; + } + + public boolean isAdmin() { + return admin; + } + + public void setAdmin(boolean admin) { + this.admin = admin; + } +} + + diff --git a/Android/app/src/main/java/com/sminnovations/bookmypcr/pojo/DataModel.java b/Android/app/src/main/java/com/sminnovations/bookmypcr/pojo/DataModel.java new file mode 100644 index 0000000..1812686 --- /dev/null +++ b/Android/app/src/main/java/com/sminnovations/bookmypcr/pojo/DataModel.java @@ -0,0 +1,33 @@ +package com.sminnovations.bookmypcr.pojo; + +/** + * Created by Pavan on 23-Apr-18. + */ + +public class DataModel { + + private String emailId; + + private boolean admin; + + public DataModel(String emailId, boolean admin) { + this.emailId = emailId; + this.admin = admin; + } + + public String getEmailId() { + return emailId; + } + + public void setEmailId(String emailId) { + this.emailId = emailId; + } + + public boolean isAdmin() { + return admin; + } + + public void setAdmin(boolean admin) { + this.admin = admin; + } +} diff --git a/Android/app/src/main/java/com/sminnovations/bookmypcr/pojo/Equipment.java b/Android/app/src/main/java/com/sminnovations/bookmypcr/pojo/Equipment.java new file mode 100644 index 0000000..63620cb --- /dev/null +++ b/Android/app/src/main/java/com/sminnovations/bookmypcr/pojo/Equipment.java @@ -0,0 +1,49 @@ +package com.sminnovations.bookmypcr.pojo; + +import com.google.firebase.database.IgnoreExtraProperties; + +import java.io.Serializable; + +/** + * Created by Pavan on 20-Mar-18. + */ +@IgnoreExtraProperties +public class Equipment implements Serializable { + + private String name; + private String manufacturer; + private String equipid; + + public Equipment(String name, String manufacturer, String equipid) { + this.name = name; + this.manufacturer = manufacturer; + this.equipid = equipid; + } + + public Equipment() { + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getEquipid() { + return equipid; + } + + public void setEquipid(String equipid) { + this.equipid = equipid; + } +} diff --git a/Android/app/src/main/java/com/sminnovations/bookmypcr/pojo/Lab.java b/Android/app/src/main/java/com/sminnovations/bookmypcr/pojo/Lab.java new file mode 100644 index 0000000..cc4c32a --- /dev/null +++ b/Android/app/src/main/java/com/sminnovations/bookmypcr/pojo/Lab.java @@ -0,0 +1,86 @@ +package com.sminnovations.bookmypcr.pojo; + +import com.google.firebase.database.IgnoreExtraProperties; + +/** + * Created by Pavan on 20-Mar-18. + */ +@IgnoreExtraProperties +public class Lab { + + private String name; + private String department; + private String university; + private String incharge; + private String inchargeNo; + private String inchargeEmail; + private String labuid; + + public Lab(String name, String department, String university, String incharge, String inchargeNo, String inchargeEmail) { + this.name = name; + this.department = department; + this.university = university; + this.incharge = incharge; + this.inchargeNo = inchargeNo; + this.inchargeEmail = inchargeEmail; + } + + public Lab() { + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDepartment() { + return department; + } + + public void setDepartment(String department) { + this.department = department; + } + + public String getUniversity() { + return university; + } + + public void setUniversity(String university) { + this.university = university; + } + + public String getIncharge() { + return incharge; + } + + public void setIncharge(String incharge) { + this.incharge = incharge; + } + + public String getInchargeNo() { + return inchargeNo; + } + + public void setInchargeNo(String inchargeNo) { + this.inchargeNo = inchargeNo; + } + + public String getInchargeEmail() { + return inchargeEmail; + } + + public void setInchargeEmail(String inchargeEmail) { + this.inchargeEmail = inchargeEmail; + } + + public String getLabuid() { + return labuid; + } + + public void setLabuid(String labuid) { + this.labuid = labuid; + } +} diff --git a/Android/app/src/main/java/com/sminnovations/bookmypcr/pojo/Pcr.java b/Android/app/src/main/java/com/sminnovations/bookmypcr/pojo/Pcr.java new file mode 100644 index 0000000..826b060 --- /dev/null +++ b/Android/app/src/main/java/com/sminnovations/bookmypcr/pojo/Pcr.java @@ -0,0 +1,72 @@ +package com.sminnovations.bookmypcr.pojo; + +/** + * Created by Pavan on 22-Apr-18. + */ + +public class Pcr { + + private String name; + private String manufacturer; + private String equipid; + private String model; + private String location; + private String comments; + + public Pcr(String name, String manufacturer, String equipid, String model, String location, String comments) { + this.name = name; + this.manufacturer = manufacturer; + this.equipid = equipid; + this.model = model; + this.location = location; + this.comments = comments; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + public String getEquipid() { + return equipid; + } + + public void setEquipid(String equipid) { + this.equipid = equipid; + } + + public String getModel() { + return model; + } + + public void setModel(String model) { + this.model = model; + } + + public String getLocation() { + return location; + } + + public void setLocation(String location) { + this.location = location; + } + + public String getComments() { + return comments; + } + + public void setComments(String comments) { + this.comments = comments; + } +} diff --git a/Android/app/src/main/java/com/sminnovations/bookmypcr/pojo/User.java b/Android/app/src/main/java/com/sminnovations/bookmypcr/pojo/User.java new file mode 100644 index 0000000..84dff6a --- /dev/null +++ b/Android/app/src/main/java/com/sminnovations/bookmypcr/pojo/User.java @@ -0,0 +1,57 @@ +package com.sminnovations.bookmypcr.pojo; + +import com.google.firebase.database.IgnoreExtraProperties; + +/** + * Created by Pavan on 20-Mar-18. + */ +@IgnoreExtraProperties +public class User { + + private String name; + private String useruid; + private boolean active; + private boolean admin; + + public User(String name, boolean active, boolean admin, String useruid) { + this.name = name; + this.active = active; + this.admin = admin; + this.useruid=useruid; + } + + public User() { + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public boolean isActive() { + return active; + } + + public void setActive(boolean active) { + this.active = active; + } + + public boolean isAdmin() { + return admin; + } + + public void setAdmin(boolean admin) { + this.admin = admin; + } + + public String getUseruid() { + return useruid; + } + + public void setUseruid(String useruid) { + this.useruid = useruid; + } +} diff --git a/Android/app/src/main/res/drawable-hdpi/ic_add_black_24dp.png b/Android/app/src/main/res/drawable-hdpi/ic_add_black_24dp.png new file mode 100644 index 0000000..13387e7 Binary files /dev/null and b/Android/app/src/main/res/drawable-hdpi/ic_add_black_24dp.png differ diff --git a/Android/app/src/main/res/drawable-hdpi/ic_add_circle_black_24dp.png b/Android/app/src/main/res/drawable-hdpi/ic_add_circle_black_24dp.png new file mode 100644 index 0000000..7eb8a62 Binary files /dev/null and b/Android/app/src/main/res/drawable-hdpi/ic_add_circle_black_24dp.png differ diff --git a/Android/app/src/main/res/drawable-hdpi/ic_close_black_24dp.png b/Android/app/src/main/res/drawable-hdpi/ic_close_black_24dp.png new file mode 100644 index 0000000..fa610ae Binary files /dev/null and b/Android/app/src/main/res/drawable-hdpi/ic_close_black_24dp.png differ diff --git a/Android/app/src/main/res/drawable-hdpi/ic_close_white_24dp.png b/Android/app/src/main/res/drawable-hdpi/ic_close_white_24dp.png new file mode 100644 index 0000000..51d3ffe Binary files /dev/null and b/Android/app/src/main/res/drawable-hdpi/ic_close_white_24dp.png differ diff --git a/Android/app/src/main/res/drawable-hdpi/ic_delete_white_24dp.png b/Android/app/src/main/res/drawable-hdpi/ic_delete_white_24dp.png new file mode 100644 index 0000000..370bef7 Binary files /dev/null and b/Android/app/src/main/res/drawable-hdpi/ic_delete_white_24dp.png differ diff --git a/Android/app/src/main/res/drawable-hdpi/ic_help_black_24dp.png b/Android/app/src/main/res/drawable-hdpi/ic_help_black_24dp.png new file mode 100644 index 0000000..e196ce1 Binary files /dev/null and b/Android/app/src/main/res/drawable-hdpi/ic_help_black_24dp.png differ diff --git a/Android/app/src/main/res/drawable-hdpi/ic_keyboard_arrow_left_black_24dp.png b/Android/app/src/main/res/drawable-hdpi/ic_keyboard_arrow_left_black_24dp.png new file mode 100644 index 0000000..d1dd6cc Binary files /dev/null and b/Android/app/src/main/res/drawable-hdpi/ic_keyboard_arrow_left_black_24dp.png differ diff --git a/Android/app/src/main/res/drawable-hdpi/ic_keyboard_arrow_right_black_24dp.png b/Android/app/src/main/res/drawable-hdpi/ic_keyboard_arrow_right_black_24dp.png new file mode 100644 index 0000000..17801f6 Binary files /dev/null and b/Android/app/src/main/res/drawable-hdpi/ic_keyboard_arrow_right_black_24dp.png differ diff --git a/Android/app/src/main/res/drawable-hdpi/ic_settings_black_24dp.png b/Android/app/src/main/res/drawable-hdpi/ic_settings_black_24dp.png new file mode 100644 index 0000000..fa8c1c5 Binary files /dev/null and b/Android/app/src/main/res/drawable-hdpi/ic_settings_black_24dp.png differ diff --git a/Android/app/src/main/res/drawable-mdpi/ic_add_black_24dp.png b/Android/app/src/main/res/drawable-mdpi/ic_add_black_24dp.png new file mode 100644 index 0000000..b2d7244 Binary files /dev/null and b/Android/app/src/main/res/drawable-mdpi/ic_add_black_24dp.png differ diff --git a/Android/app/src/main/res/drawable-mdpi/ic_add_circle_black_24dp.png b/Android/app/src/main/res/drawable-mdpi/ic_add_circle_black_24dp.png new file mode 100644 index 0000000..df73571 Binary files /dev/null and b/Android/app/src/main/res/drawable-mdpi/ic_add_circle_black_24dp.png differ diff --git a/Android/app/src/main/res/drawable-mdpi/ic_close_black_24dp.png b/Android/app/src/main/res/drawable-mdpi/ic_close_black_24dp.png new file mode 100644 index 0000000..0ba4616 Binary files /dev/null and b/Android/app/src/main/res/drawable-mdpi/ic_close_black_24dp.png differ diff --git a/Android/app/src/main/res/drawable-mdpi/ic_close_white_24dp.png b/Android/app/src/main/res/drawable-mdpi/ic_close_white_24dp.png new file mode 100644 index 0000000..f26e9e1 Binary files /dev/null and b/Android/app/src/main/res/drawable-mdpi/ic_close_white_24dp.png differ diff --git a/Android/app/src/main/res/drawable-mdpi/ic_delete_white_24dp.png b/Android/app/src/main/res/drawable-mdpi/ic_delete_white_24dp.png new file mode 100644 index 0000000..8d48370 Binary files /dev/null and b/Android/app/src/main/res/drawable-mdpi/ic_delete_white_24dp.png differ diff --git a/Android/app/src/main/res/drawable-mdpi/ic_help_black_24dp.png b/Android/app/src/main/res/drawable-mdpi/ic_help_black_24dp.png new file mode 100644 index 0000000..9ed9f00 Binary files /dev/null and b/Android/app/src/main/res/drawable-mdpi/ic_help_black_24dp.png differ diff --git a/Android/app/src/main/res/drawable-mdpi/ic_keyboard_arrow_left_black_24dp.png b/Android/app/src/main/res/drawable-mdpi/ic_keyboard_arrow_left_black_24dp.png new file mode 100644 index 0000000..ebdca6d Binary files /dev/null and b/Android/app/src/main/res/drawable-mdpi/ic_keyboard_arrow_left_black_24dp.png differ diff --git a/Android/app/src/main/res/drawable-mdpi/ic_keyboard_arrow_right_black_24dp.png b/Android/app/src/main/res/drawable-mdpi/ic_keyboard_arrow_right_black_24dp.png new file mode 100644 index 0000000..9be7f6a Binary files /dev/null and b/Android/app/src/main/res/drawable-mdpi/ic_keyboard_arrow_right_black_24dp.png differ diff --git a/Android/app/src/main/res/drawable-mdpi/ic_settings_black_24dp.png b/Android/app/src/main/res/drawable-mdpi/ic_settings_black_24dp.png new file mode 100644 index 0000000..63a0673 Binary files /dev/null and b/Android/app/src/main/res/drawable-mdpi/ic_settings_black_24dp.png differ diff --git a/Android/app/src/main/res/drawable-mdpi/shanmukha.jpg b/Android/app/src/main/res/drawable-mdpi/shanmukha.jpg new file mode 100644 index 0000000..4f61e77 Binary files /dev/null and b/Android/app/src/main/res/drawable-mdpi/shanmukha.jpg differ diff --git a/Android/app/src/main/res/drawable-mdpi/shanmukha_splash.jpg b/Android/app/src/main/res/drawable-mdpi/shanmukha_splash.jpg new file mode 100644 index 0000000..a241135 Binary files /dev/null and b/Android/app/src/main/res/drawable-mdpi/shanmukha_splash.jpg differ diff --git a/Android/app/src/main/res/drawable-mdpi/splash.png b/Android/app/src/main/res/drawable-mdpi/splash.png new file mode 100644 index 0000000..eaf3be8 Binary files /dev/null and b/Android/app/src/main/res/drawable-mdpi/splash.png differ diff --git a/Android/app/src/main/res/drawable-mdpi/splash3.png b/Android/app/src/main/res/drawable-mdpi/splash3.png new file mode 100644 index 0000000..80ea725 Binary files /dev/null and b/Android/app/src/main/res/drawable-mdpi/splash3.png differ diff --git a/Android/app/src/main/res/drawable-mdpi/splash4.png b/Android/app/src/main/res/drawable-mdpi/splash4.png new file mode 100644 index 0000000..3df58d2 Binary files /dev/null and b/Android/app/src/main/res/drawable-mdpi/splash4.png differ diff --git a/Android/app/src/main/res/drawable-mdpi/splash_2.png b/Android/app/src/main/res/drawable-mdpi/splash_2.png new file mode 100644 index 0000000..2dce5e7 Binary files /dev/null and b/Android/app/src/main/res/drawable-mdpi/splash_2.png differ diff --git a/Android/app/src/main/res/drawable-v21/ic_menu_camera.xml b/Android/app/src/main/res/drawable-v21/ic_menu_camera.xml new file mode 100644 index 0000000..0d9ea10 --- /dev/null +++ b/Android/app/src/main/res/drawable-v21/ic_menu_camera.xml @@ -0,0 +1,12 @@ + + + + diff --git a/Android/app/src/main/res/drawable-v21/ic_menu_gallery.xml b/Android/app/src/main/res/drawable-v21/ic_menu_gallery.xml new file mode 100644 index 0000000..f6872c4 --- /dev/null +++ b/Android/app/src/main/res/drawable-v21/ic_menu_gallery.xml @@ -0,0 +1,9 @@ + + + diff --git a/Android/app/src/main/res/drawable-v21/ic_menu_manage.xml b/Android/app/src/main/res/drawable-v21/ic_menu_manage.xml new file mode 100644 index 0000000..c1be60b --- /dev/null +++ b/Android/app/src/main/res/drawable-v21/ic_menu_manage.xml @@ -0,0 +1,9 @@ + + + \ No newline at end of file diff --git a/Android/app/src/main/res/drawable-v21/ic_menu_send.xml b/Android/app/src/main/res/drawable-v21/ic_menu_send.xml new file mode 100644 index 0000000..00c668c --- /dev/null +++ b/Android/app/src/main/res/drawable-v21/ic_menu_send.xml @@ -0,0 +1,9 @@ + + + diff --git a/Android/app/src/main/res/drawable-v21/ic_menu_share.xml b/Android/app/src/main/res/drawable-v21/ic_menu_share.xml new file mode 100644 index 0000000..a28fb9e --- /dev/null +++ b/Android/app/src/main/res/drawable-v21/ic_menu_share.xml @@ -0,0 +1,9 @@ + + + diff --git a/Android/app/src/main/res/drawable-v21/ic_menu_slideshow.xml b/Android/app/src/main/res/drawable-v21/ic_menu_slideshow.xml new file mode 100644 index 0000000..209aa64 --- /dev/null +++ b/Android/app/src/main/res/drawable-v21/ic_menu_slideshow.xml @@ -0,0 +1,9 @@ + + + diff --git a/Android/app/src/main/res/drawable-v24/background_splash.xml b/Android/app/src/main/res/drawable-v24/background_splash.xml new file mode 100644 index 0000000..83f68b7 --- /dev/null +++ b/Android/app/src/main/res/drawable-v24/background_splash.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/Android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/Android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..c7bd21d --- /dev/null +++ b/Android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + diff --git a/Android/app/src/main/res/drawable-xhdpi/ic_add_black_24dp.png b/Android/app/src/main/res/drawable-xhdpi/ic_add_black_24dp.png new file mode 100644 index 0000000..e49c67c Binary files /dev/null and b/Android/app/src/main/res/drawable-xhdpi/ic_add_black_24dp.png differ diff --git a/Android/app/src/main/res/drawable-xhdpi/ic_add_circle_black_24dp.png b/Android/app/src/main/res/drawable-xhdpi/ic_add_circle_black_24dp.png new file mode 100644 index 0000000..f26e05f Binary files /dev/null and b/Android/app/src/main/res/drawable-xhdpi/ic_add_circle_black_24dp.png differ diff --git a/Android/app/src/main/res/drawable-xhdpi/ic_close_black_24dp.png b/Android/app/src/main/res/drawable-xhdpi/ic_close_black_24dp.png new file mode 100644 index 0000000..637e06c Binary files /dev/null and b/Android/app/src/main/res/drawable-xhdpi/ic_close_black_24dp.png differ diff --git a/Android/app/src/main/res/drawable-xhdpi/ic_close_white_24dp.png b/Android/app/src/main/res/drawable-xhdpi/ic_close_white_24dp.png new file mode 100644 index 0000000..9803ea3 Binary files /dev/null and b/Android/app/src/main/res/drawable-xhdpi/ic_close_white_24dp.png differ diff --git a/Android/app/src/main/res/drawable-xhdpi/ic_delete_white_24dp.png b/Android/app/src/main/res/drawable-xhdpi/ic_delete_white_24dp.png new file mode 100644 index 0000000..e9b5411 Binary files /dev/null and b/Android/app/src/main/res/drawable-xhdpi/ic_delete_white_24dp.png differ diff --git a/Android/app/src/main/res/drawable-xhdpi/ic_help_black_24dp.png b/Android/app/src/main/res/drawable-xhdpi/ic_help_black_24dp.png new file mode 100644 index 0000000..1101da7 Binary files /dev/null and b/Android/app/src/main/res/drawable-xhdpi/ic_help_black_24dp.png differ diff --git a/Android/app/src/main/res/drawable-xhdpi/ic_keyboard_arrow_left_black_24dp.png b/Android/app/src/main/res/drawable-xhdpi/ic_keyboard_arrow_left_black_24dp.png new file mode 100644 index 0000000..139dfd3 Binary files /dev/null and b/Android/app/src/main/res/drawable-xhdpi/ic_keyboard_arrow_left_black_24dp.png differ diff --git a/Android/app/src/main/res/drawable-xhdpi/ic_keyboard_arrow_right_black_24dp.png b/Android/app/src/main/res/drawable-xhdpi/ic_keyboard_arrow_right_black_24dp.png new file mode 100644 index 0000000..c0ba00f Binary files /dev/null and b/Android/app/src/main/res/drawable-xhdpi/ic_keyboard_arrow_right_black_24dp.png differ diff --git a/Android/app/src/main/res/drawable-xhdpi/ic_settings_black_24dp.png b/Android/app/src/main/res/drawable-xhdpi/ic_settings_black_24dp.png new file mode 100644 index 0000000..e563dfb Binary files /dev/null and b/Android/app/src/main/res/drawable-xhdpi/ic_settings_black_24dp.png differ diff --git a/Android/app/src/main/res/drawable-xxhdpi/ic_add_black_24dp.png b/Android/app/src/main/res/drawable-xxhdpi/ic_add_black_24dp.png new file mode 100644 index 0000000..73784b3 Binary files /dev/null and b/Android/app/src/main/res/drawable-xxhdpi/ic_add_black_24dp.png differ diff --git a/Android/app/src/main/res/drawable-xxhdpi/ic_add_circle_black_24dp.png b/Android/app/src/main/res/drawable-xxhdpi/ic_add_circle_black_24dp.png new file mode 100644 index 0000000..f26f33f Binary files /dev/null and b/Android/app/src/main/res/drawable-xxhdpi/ic_add_circle_black_24dp.png differ diff --git a/Android/app/src/main/res/drawable-xxhdpi/ic_close_black_24dp.png b/Android/app/src/main/res/drawable-xxhdpi/ic_close_black_24dp.png new file mode 100644 index 0000000..2f49029 Binary files /dev/null and b/Android/app/src/main/res/drawable-xxhdpi/ic_close_black_24dp.png differ diff --git a/Android/app/src/main/res/drawable-xxhdpi/ic_close_white_24dp.png b/Android/app/src/main/res/drawable-xxhdpi/ic_close_white_24dp.png new file mode 100644 index 0000000..ba0dd12 Binary files /dev/null and b/Android/app/src/main/res/drawable-xxhdpi/ic_close_white_24dp.png differ diff --git a/Android/app/src/main/res/drawable-xxhdpi/ic_delete_white_24dp.png b/Android/app/src/main/res/drawable-xxhdpi/ic_delete_white_24dp.png new file mode 100644 index 0000000..57c9b63 Binary files /dev/null and b/Android/app/src/main/res/drawable-xxhdpi/ic_delete_white_24dp.png differ diff --git a/Android/app/src/main/res/drawable-xxhdpi/ic_help_black_24dp.png b/Android/app/src/main/res/drawable-xxhdpi/ic_help_black_24dp.png new file mode 100644 index 0000000..c776e87 Binary files /dev/null and b/Android/app/src/main/res/drawable-xxhdpi/ic_help_black_24dp.png differ diff --git a/Android/app/src/main/res/drawable-xxhdpi/ic_keyboard_arrow_left_black_24dp.png b/Android/app/src/main/res/drawable-xxhdpi/ic_keyboard_arrow_left_black_24dp.png new file mode 100644 index 0000000..a5235ca Binary files /dev/null and b/Android/app/src/main/res/drawable-xxhdpi/ic_keyboard_arrow_left_black_24dp.png differ diff --git a/Android/app/src/main/res/drawable-xxhdpi/ic_keyboard_arrow_right_black_24dp.png b/Android/app/src/main/res/drawable-xxhdpi/ic_keyboard_arrow_right_black_24dp.png new file mode 100644 index 0000000..53b89f6 Binary files /dev/null and b/Android/app/src/main/res/drawable-xxhdpi/ic_keyboard_arrow_right_black_24dp.png differ diff --git a/Android/app/src/main/res/drawable-xxhdpi/ic_settings_black_24dp.png b/Android/app/src/main/res/drawable-xxhdpi/ic_settings_black_24dp.png new file mode 100644 index 0000000..c339324 Binary files /dev/null and b/Android/app/src/main/res/drawable-xxhdpi/ic_settings_black_24dp.png differ diff --git a/Android/app/src/main/res/drawable-xxxhdpi/ic_add_black_24dp.png b/Android/app/src/main/res/drawable-xxxhdpi/ic_add_black_24dp.png new file mode 100644 index 0000000..1b1dded Binary files /dev/null and b/Android/app/src/main/res/drawable-xxxhdpi/ic_add_black_24dp.png differ diff --git a/Android/app/src/main/res/drawable-xxxhdpi/ic_add_circle_black_24dp.png b/Android/app/src/main/res/drawable-xxxhdpi/ic_add_circle_black_24dp.png new file mode 100644 index 0000000..1f9394c Binary files /dev/null and b/Android/app/src/main/res/drawable-xxxhdpi/ic_add_circle_black_24dp.png differ diff --git a/Android/app/src/main/res/drawable-xxxhdpi/ic_close_black_24dp.png b/Android/app/src/main/res/drawable-xxxhdpi/ic_close_black_24dp.png new file mode 100644 index 0000000..dcface3 Binary files /dev/null and b/Android/app/src/main/res/drawable-xxxhdpi/ic_close_black_24dp.png differ diff --git a/Android/app/src/main/res/drawable-xxxhdpi/ic_close_white_24dp.png b/Android/app/src/main/res/drawable-xxxhdpi/ic_close_white_24dp.png new file mode 100644 index 0000000..9ff9b47 Binary files /dev/null and b/Android/app/src/main/res/drawable-xxxhdpi/ic_close_white_24dp.png differ diff --git a/Android/app/src/main/res/drawable-xxxhdpi/ic_delete_white_24dp.png b/Android/app/src/main/res/drawable-xxxhdpi/ic_delete_white_24dp.png new file mode 100644 index 0000000..3d4676b Binary files /dev/null and b/Android/app/src/main/res/drawable-xxxhdpi/ic_delete_white_24dp.png differ diff --git a/Android/app/src/main/res/drawable-xxxhdpi/ic_help_black_24dp.png b/Android/app/src/main/res/drawable-xxxhdpi/ic_help_black_24dp.png new file mode 100644 index 0000000..09888ee Binary files /dev/null and b/Android/app/src/main/res/drawable-xxxhdpi/ic_help_black_24dp.png differ diff --git a/Android/app/src/main/res/drawable-xxxhdpi/ic_keyboard_arrow_left_black_24dp.png b/Android/app/src/main/res/drawable-xxxhdpi/ic_keyboard_arrow_left_black_24dp.png new file mode 100644 index 0000000..e683ae6 Binary files /dev/null and b/Android/app/src/main/res/drawable-xxxhdpi/ic_keyboard_arrow_left_black_24dp.png differ diff --git a/Android/app/src/main/res/drawable-xxxhdpi/ic_keyboard_arrow_right_black_24dp.png b/Android/app/src/main/res/drawable-xxxhdpi/ic_keyboard_arrow_right_black_24dp.png new file mode 100644 index 0000000..1aa2900 Binary files /dev/null and b/Android/app/src/main/res/drawable-xxxhdpi/ic_keyboard_arrow_right_black_24dp.png differ diff --git a/Android/app/src/main/res/drawable-xxxhdpi/ic_settings_black_24dp.png b/Android/app/src/main/res/drawable-xxxhdpi/ic_settings_black_24dp.png new file mode 100644 index 0000000..3211218 Binary files /dev/null and b/Android/app/src/main/res/drawable-xxxhdpi/ic_settings_black_24dp.png differ diff --git a/Android/app/src/main/res/drawable/ic_launcher_background.xml b/Android/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..d5fccc5 --- /dev/null +++ b/Android/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Android/app/src/main/res/drawable/side_nav_bar.xml b/Android/app/src/main/res/drawable/side_nav_bar.xml new file mode 100644 index 0000000..6d81870 --- /dev/null +++ b/Android/app/src/main/res/drawable/side_nav_bar.xml @@ -0,0 +1,9 @@ + + + \ No newline at end of file diff --git a/Android/app/src/main/res/layout/activity_about_us.xml b/Android/app/src/main/res/layout/activity_about_us.xml new file mode 100644 index 0000000..54b16de --- /dev/null +++ b/Android/app/src/main/res/layout/activity_about_us.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + diff --git a/Android/app/src/main/res/layout/activity_add_pcr.xml b/Android/app/src/main/res/layout/activity_add_pcr.xml new file mode 100644 index 0000000..e61b283 --- /dev/null +++ b/Android/app/src/main/res/layout/activity_add_pcr.xml @@ -0,0 +1,93 @@ + + + + + + + + +