Commit 945846ed authored by Hasitha Samarasekara's avatar Hasitha Samarasekara

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	WebFrontEnd/smartcoach-frontend/package-lock.json
#	WebFrontEnd/smartcoach-frontend/package.json
parents e7f90597 48f1d587
......@@ -5,6 +5,8 @@
<excludeFolder url="file://$MODULE_DIR$/temp" />
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
<excludeFolder url="file://$MODULE_DIR$/MobileFrontEnd/FlutterApplication/flutter_app/.pub" />
<excludeFolder url="file://$MODULE_DIR$/MobileFrontEnd/FlutterApplication/flutter_app/build" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
......
module.exports = {
mongoURI: 'mongodb+srv://admin:admin@cluster0.wmb3b.mongodb.net/SmartCoach?retryWrites=true&w=majority',
};
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
let Answer = new Schema({
answer_id: mongoose.Schema.Types.ObjectId,
student_id: {
type: String
},
student_name:{
type:String
},
lesson_no:{
type:Number
},
no_of_questions:{
type:Number
},
question_text:{
type:String
},
question_answer:{
type:String
},
defult_mark:{
type:Number
}
});
module.exports = mongoose.model('Answer',Answer);
\ No newline at end of file
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const ImageSchema = new Schema({
caption: {
required: true,
type: String,
},
lessonname: {
required: true,
type: String,
},
lessonno: {
required: true,
type: String,
},
filename: {
required: true,
type: String,
},
fileId: {
required: true,
type: String,
},
createdAt: {
default: Date.now(),
type: Date,
},
});
const Image = mongoose.model('Image', ImageSchema);
module.exports = Image;
\ No newline at end of file
......@@ -4,10 +4,10 @@ const Schema = mongoose.Schema;
let Question = new Schema({
question_id: mongoose.Schema.Types.ObjectId,
category:{
type:String
lesson_no:{
type:Number
},
name:{
lesson_name:{
type:String
},
question_text:{
......@@ -17,10 +17,7 @@ let Question = new Schema({
type:String
},
defult_mark:{
type: Number
},
q_type:{
type: String
type:Number
},
time_createdby:{
type: Date
......
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
let PerformanceSchema = new Schema({
student_id : {type:mongoose.Schema.Types.ObjectId,ref: 'student', required:true},
sex : {type:Boolean, required:true},
study_time : {type: Number, required:true},
activities : {type: Boolean, required:true},
internet : {type: Boolean, required:true},
free_time : {type: Number, required:true},
absences : {type: Number, required:true},
g1 : {type: Number, required:true},
g2 : {type: Number, required:true}
},{
timestamps : true
});
const StudPerf = mongoose.model('stud_performance', PerformanceSchema);
module.exports = StudPerf;
\ No newline at end of file
This diff is collapsed.
......@@ -10,14 +10,12 @@
"author": "",
"license": "ISC",
"dependencies": {
"axios": "^0.21.4",
"cors": "^2.8.5",
"dotenv": "^10.0.0",
"express": "^4.17.1",
"mongoose": "^5.12.15"
},
"devDependencies": {
"nodemailer": "^6.6.2",
"request": "^2.88.2"
"nodemailer": "^6.6.2"
}
}
const answerRoute = require('express').Router();
let answer = require('../models/answer.model');
const mongoose = require('mongoose');
answerRoute.route('/').get(function(req, res) {
answer.find(function(err, questions) {
if (err) {
console.log(err);
res.render('index');
} else {
res.json(questions);
}
});
});
answerRoute.route('/:id').get(function (req, res) {
let id = req.params.id;
answer.findById(id, function (err, question) {
res.json(question);
});
});
answerRoute.route('/questionId/:id').get(function (req, res) {
console.log("Question ID");
console.log(req.params.id);
let id = req.params.id;
answer.find({"_id" : id}, function (err, question) {
res.json(question);
});
});
answerRoute.route('/add').post(function(req, res) {
const ans = new answer({
answer_id: new mongoose.Types.ObjectId(),
student_id : req.body.student_id,
student_name : req.body.student_name,
lesson_no : req.body.lesson_no,
no_of_questions : req.body.no_of_questions,
question_text: req.body.question_text,
question_answer:req.body.question_answer,
defult_mark: req.body.defult_mark,
});
ans.save().then(ans =>{
res.json('Item update!');
})
.catch(err =>{
res.status(400).send("Update not possible");
});
});
answerRoute.route('/update/:id').post((req, res) => {
answer.findById(req.params.id,function(err, answer){
if(!answer)
req.status(404).send("data is not found");
else {
answer.lesson_no = req.body.lesson_no,
answer.student_id = req.body.student_id,
answer.student_name = req.body.student_name,
answer.no_of_questions = req.body.no_of_questions,
answer.question_text = req.body.question_text,
answer.question_answer = req.body.question_answer,
answer.defult_mark = req.body.defult_mark
}
answer.save().then(answer =>{
res.json('Item update!');
})
.catch(err =>{
res.status(400).send("Update not possible");
});
});
});
answerRoute.route('/lessonNo/:id').get(function (req, res) {
console.log("Product Item ID");
console.log(req.params.id);
let id = req.params.id;
answer.find({"lesson_no" : id}, function (err, answer) {
res.json(answer);
});
});
answerRoute.route('/delete/:id').delete((req, res) => {
answer.findByIdAndDelete(req.params.id)
.then(() => res.json('Product Deleted.'))
.catch(err => res.status(400).json('Error: ' + err));
});
module.exports = answerRoute;
\ No newline at end of file
const express = require('express');
const imageRouter = express.Router();
const mongoose = require('mongoose');
const Image = require('../models/pdf.model');
const config = require('../config');
module.exports = (upload) => {
const url = config.mongoURI;
const connect = mongoose.createConnection(url, {useNewUrlParser: true, useUnifiedTopology: true});
let gfs;
connect.once('open', () => {
// initialize stream
gfs = new mongoose.mongo.GridFSBucket(connect.db, {
bucketName: "uploads"
});
});
/*
POST: Upload a single image/file to Image collection
*/
imageRouter.route('/')
.post(upload.single('file'), (req, res, next) => {
console.log(req.body);
// check for existing images
Image.findOne({caption: req.body.caption})
.then((image) => {
console.log(image);
if (image) {
return res.status(200).json({
success: false,
message: 'Image already exists',
});
}
let newImage = new Image({
lessonname: req.body.lessonname,
lessonno: req.body.lessonno,
caption: req.body.caption,
filename: req.file.filename,
fileId: req.file.id,
});
newImage.save()
.then((image) => {
res.status(200).json({
success: true,
image,
});
})
.catch(err => res.status(500).json(err));
})
.catch(err => res.status(500).json(err));
})
.get((req, res, next) => {
Image.find({})
.then(images => {
res.status(200).json({
success: true,
images,
});
})
.catch(err => res.status(500).json(err));
});
/*
GET: Delete an image from the collection
*/
imageRouter.route('/delete/:id')
.get((req, res, next) => {
Image.findOne({_id: req.params.id})
.then((image) => {
if (image) {
Image.deleteOne({_id: req.params.id})
.then(() => {
return res.status(200).json({
success: true,
message: `File with ID: ${req.params.id} deleted`,
});
})
.catch(err => {
return res.status(500).json(err)
});
} else {
res.status(200).json({
success: false,
message: `File with ID: ${req.params.id} not found`,
});
}
})
.catch(err => res.status(500).json(err));
});
/*
GET: Fetch most recently added record
*/
imageRouter.route('/recent')
.get((req, res, next) => {
Image.findOne({}, {}, {sort: {'_id': -1}})
.then((image) => {
res.status(200).json({
success: true,
image,
});
})
.catch(err => res.status(500).json(err));
});
/*
POST: Upload multiple files upto 3
*/
imageRouter.route('/multiple')
.post(upload.array('file', 3), (req, res, next) => {
res.status(200).json({
success: true,
message: `${req.files.length} files uploaded successfully`,
});
});
/*
GET: Fetches all the files in the uploads collection
*/
imageRouter.route('/')
.get((req, res, next) => {
gfs.find().toArray((err, files) => {
if (!files || files.length === 0) {
return res.status(200).json({
success: false,
message: 'No files available'
});
}
files.map(file => {
if (file.contentType === 'image/jpeg' || file.contentType === 'image/png' || file.contentType === 'image/svg') {
file.isImage = true;
} else {
file.isImage = false;
}
});
res.status(200).json({
success: true,
files,
});
});
});
/*
GET: Fetches a particular file by filename
*/
imageRouter.route('/file/:filename')
.get((req, res, next) => {
gfs.find({ filename: req.params.filename }).toArray((err, files) => {
if (!files[0] || files.length === 0) {
return res.status(200).json({
success: false,
message: 'No files available',
});
}
res.status(200).json({
success: true,
file: files[0],
});
});
});
/*
GET: Fetches a particular image and render on browser
*/
imageRouter.route('/image/:filename')
.get((req, res, next) => {
gfs.find({ filename: req.params.filename }).toArray((err, files) => {
if (!files[0] || files.length === 0) {
return res.status(200).json({
success: false,
message: 'No files available',
});
}
if (files[0].contentType === 'image/jpeg' || files[0].contentType === 'image/png' || files[0].contentType === 'image/svg+xml') {
// render image to browser
gfs.openDownloadStreamByName(req.params.filename).pipe(res);
} else {
res.status(404).json({
err: 'Not an image',
});
}
});
});
/*
GET: Fetches a particular PDF and render on browser
*/
imageRouter.route('/pdf/:filename')
.get((req, res, next) => {
gfs.find({ filename: req.params.filename }).toArray((err, files) => {
if (!files[0] || files.length === 0) {
return res.status(200).json({
success: false,
message: 'No files available',
});
}
if (files[0].contentType === 'application/pdf' || files[0].contentType === 'application/vnd.ms-powerpoint'|| files[0].contentType === 'application/vnd.openxmlformats-officedocument.presentationml.presentation') {
// render PDF to browser
gfs.openDownloadStreamByName(req.params.filename).pipe(res);
} else {
res.status(404).json({
err: 'Not a PDF',
});
}
});
});
/*
DELETE: Delete a particular file by an ID
*/
imageRouter.route('/file/del/:id')
.post((req, res, next) => {
console.log(req.params.id);
gfs.delete(new mongoose.Types.ObjectId(req.params.id), (err, data) => {
if (err) {
return res.status(404).json({ err: err });
}
res.status(200).json({
success: true,
message: `File with ID ${req.params.id} is deleted`,
});
});
});
return imageRouter;
};
\ No newline at end of file
......@@ -13,6 +13,7 @@ questionRouter.route('/').get(function(req, res) {
});
});
questionRouter.route('/:id').get(function (req, res) {
let id = req.params.id;
Question.findById(id, function (err, question) {
......@@ -32,43 +33,20 @@ questionRouter.route('/questionId/:id').get(function (req, res) {
questionRouter.route('/add').post(function(req, res) {
const question = new Question({
question_id: new mongoose.Types.ObjectId(),
category : req.body.category,
name : req.body.name,
lesson_no : req.body.lesson_no,
lesson_name : req.body.lesson_name,
question_text: req.body.question_text,
question_answer:req.body.question_answer,
defult_mark: req.body.defult_mark,
q_type: req.body.q_type,
time_createdby: req.body.time_createdby,
time_modifiedby: req.body.time_modifiedby,
general_feedback: req.body.general_feedback
});
question
.save()
.then(result => {
res.json(result);
console.log(result);
res.status(201).json({
message: "Created product successfully",
createdProduct: {
category: result.category,
name: result.name,
question_text: result.question_text,
defult_mark: result.defult_mark,
q_type: result.q_type,
time_createdby: req.body.time_createdby,
time_modifiedby: req.body.time_modifiedby,
general_feedback: req.body.general_feedback,
question_id: result.question_id,
request: {
type: 'GET',
url: "http://localhost:5000/questions/" + result._id
}
}
});
})
.catch(err => {
console.log(err);
res.status(500).json({error: err});
question.save().then(question =>{
res.json('Item update!');
})
.catch(err =>{
res.status(400).send("Update not possible");
});
});
......@@ -77,8 +55,8 @@ questionRouter.route('/update/:id').post((req, res) => {
if(!question)
req.status(404).send("data is not found");
else {
question.category = req.body.category;
question.name = req.body.name;
question.lesson_no = req.body.lesson_no;
question.lesson_name = req.body.lesson_name;
question.question_text = req.body.question_text;
question.question_answer = req.body.question_answer;
question.defult_mark = req.body.defult_mark;
......@@ -96,7 +74,14 @@ questionRouter.route('/update/:id').post((req, res) => {
});
});
questionRouter.route('c').get(function (req, res) {
console.log("Product Item ID");
console.log(req.params.id);
let id = req.params.id;
Question.find({"lesson_no" : id}, function (err, product) {
res.json(product);
});
});
questionRouter.route('/delete/:id').delete((req, res) => {
Question.findByIdAndDelete(req.params.id)
......
const router = require('express').Router();
const StudPer = require('../models/studPer.model');
router.route('/store').post((req ,res) =>{
const student_id = req.body.student_id;
const sex = req.body.sex;
const study_time = req.body.study_time;
const activities = req.body.activities;
const internet = req.body.internet;
const free_time = req.body.free_time;
const absences = req.body.absences;
const g1 = req.body.g1;
const g2 = req.body.g2;
const newPerformanceDetails = new StudPer({
student_id,
sex,
study_time,
activities,
internet,
free_time,
absences,
g1,
g2
});
newPerformanceDetails.save()
.then(()=> res.json('Student Performance Details Added!'))
.catch(err => res.status(400).json('Error :'+err));
});
module.exports = router;
\ No newline at end of file
const createError = require('http-errors');
const express = require('express');
const path = require('path');
const cookieParser = require('cookie-parser');
const logger = require('morgan');
const methodOverride = require('method-override');
const config = require('./config');
const multer = require('multer');
const {GridFsStorage} = require('multer-gridfs-storage');
const crypto = require('crypto');
const cors = require('cors');
const bodyParser = require('body-parser');
const mongoose =require('mongoose');
require('dotenv').config();
const app = express();
const port = process.env.PORT || 5001;
const port = process.env.PORT || 5000;
app.use(bodyParser.urlencoded({ extended: true }));
app.use(cors());
// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
app.use(cors({
origin: '*',
}));
app.use(logger('dev'));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(methodOverride('_method'));
app.use(express.static(path.join(__dirname, 'public')));
mongoose.Promise = require('bluebird');
const uri = process.env.ATLAS_URI;
mongoose.connect(uri,{useNewUrlParser:true, useUnifiedTopology: true, useCreateIndex:true, useFindAndModify: false });
const url = config.mongoURI;
const connect = mongoose.connect(url, { useNewUrlParser:true, useUnifiedTopology: true, useCreateIndex:true, useFindAndModify: false });
const connection = mongoose.connection;
connection.once('open',() => {
console.log("MongoDB database connection established successfully");
}).catch(err => {
console.error('App starting error:', err.stack);
process.exit(1);
connect.then(() => {
console.log('Connected to database: GridApp');
}, (err) => console.log(err));
// create storage engine
const storage = new GridFsStorage({
url: config.mongoURI,
file: (req, file) => {
return new Promise((resolve, reject) => {
crypto.randomBytes(16, (err, buf) => {
if (err) {
return reject(err);
}
const filename = buf.toString('hex') + path.extname(file.originalname);
const fileInfo = {
filename: filename,
bucketName: 'uploads'
};
resolve(fileInfo);
});
});
}
});
const upload = multer({ storage });
// const connection = mongoose.connection;
// connection.once('open',() => {
// console.log("MongoDB database connection established successfully");
// }).catch(err => {
// console.error('App starting error:', err.stack);
// process.exit(1);
// });
const studentRouter = require('./routes/student.route');
const tutorRouter = require('./routes/tutor.route');
const instituteRouter = require('./routes/institute.route');
......@@ -32,17 +84,20 @@ const studentResult = require('./routes/studentALResult.route');
const tutorRating = require('./routes/tutorRatings.route');
const filteredList = require('./routes/filteredListNew.route');
const createClassRoute = require('./routes/createClass.route');
const studPerRoute = require('./routes/studper.route');
app.use('/studentSingUp',studentRouter);
app.use('/tutorSingUp',tutorRouter);
app.use('/instituteSingUp',instituteRouter);
app.use('/userAccount',userAccount);
app.use('/questions', questionManage);
app.use('/answer', answerManage);
app.use('/admin/finance', financeRouter);
app.use('/studentResults', studentResult);
app.use('/tutorRatings', tutorRating);
app.use('/filteredList', filteredList);
app.use('/createClass', createClassRoute);
app.use('/admin/studper',studPerRoute);
app.listen(port, () => {
console.log(`Server is running on Port: ${port}`);
......
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
# Default ignored files
/shelf/
/workspace.xml
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="11" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="GRADLE" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DesignSurface">
<option name="filePathToZoomLevelMap">
<map>
<entry key="../../Android/Sdk/platforms/android-30/data/res/layout/simple_list_item_1.xml" value="0.3677536231884058" />
<entry key="..\:/Users/HANSAKA/Desktop/Research Development/ELearningApp/app/src/main/res/layout/activity_attendence.xml" value="0.1802536231884058" />
<entry key="app/src/main/res/drawable-v24/grey_back_curved.xml" value="0.434375" />
<entry key="app/src/main/res/drawable-v24/ic_launcher_foreground.xml" value="0.2557291666666667" />
<entry key="app/src/main/res/drawable-v24/white_curved.xml" value="0.2557291666666667" />
<entry key="app/src/main/res/drawable/darkgrey_back_curved.xml" value="0.434375" />
<entry key="app/src/main/res/drawable/ic_launcher_background.xml" value="0.2557291666666667" />
<entry key="app/src/main/res/drawable/ic_launcher_bg.xml" value="0.2557291666666667" />
<entry key="app/src/main/res/drawable/list_item.xml" value="0.2557291666666667" />
<entry key="app/src/main/res/layout/activity_attendence.xml" value="0.3061594202898551" />
<entry key="app/src/main/res/layout/activity_class_add.xml" value="0.3555253623188406" />
<entry key="app/src/main/res/layout/activity_class_detail_activty.xml" value="0.23958333333333334" />
<entry key="app/src/main/res/layout/activity_class_edit.xml" value="0.3555253623188406" />
<entry key="app/src/main/res/layout/activity_home.xml" value="0.2866847826086957" />
<entry key="app/src/main/res/layout/activity_join.xml" value="0.3333333333333333" />
<entry key="app/src/main/res/layout/activity_login.xml" value="0.23958333333333334" />
<entry key="app/src/main/res/layout/activity_main.xml" value="0.2848731884057971" />
<entry key="app/src/main/res/layout/activity_student_list.xml" value="0.3677536231884058" />
<entry key="app/src/main/res/layout/activity_timer.xml" value="0.3759057971014493" />
<entry key="app/src/main/res/layout/activity_tutor_join.xml" value="0.3759057971014493" />
<entry key="app/src/main/res/layout/list_item.xml" value="0.3555253623188406" />
<entry key="app/src/main/res/layout/student_list_item.xml" value="0.3677536231884058" />
<entry key="app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml" value="0.2557291666666667" />
<entry key="app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml" value="0.2557291666666667" />
</map>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
<component name="VisualizationToolProject">
<option name="state">
<ProjectState>
<option name="scale" value="0.2866847826086957" />
</ProjectState>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>
\ No newline at end of file
/build
\ No newline at end of file
plugins {
id 'com.android.application'
}
android {
compileSdk 30
defaultConfig {
applicationId "com.symbol.elearningapp"
minSdk 26
targetSdk 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
implementation 'com.squareup.retrofit2:converter-scalars:2.9.0'
implementation 'com.intuit.ssp:ssp-android:1.0.6'
implementation 'com.intuit.sdp:sdp-android:1.0.6'
implementation 'com.google.android.gms:play-services:12.0.1'
def camerax_version = "1.0.0-beta05"
implementation "androidx.camera:camera-camera2:${camerax_version}"
implementation "androidx.camera:camera-lifecycle:${camerax_version}"
implementation"androidx.camera:camera-view:1.0.0-alpha12"
implementation "androidx.camera:camera-extensions:1.0.0-alpha12"
// For Card view
implementation 'androidx.cardview:cardview:1.0.0'
// Chart and graph library
implementation 'com.github.blackfizz:eazegraph:1.2.5l@aar'
implementation 'com.nineoldandroids:library:2.4.0'
}
\ No newline at end of file
# 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
\ No newline at end of file
package com.symbol.elearningapp;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.symbol.elearningapp", appContext.getPackageName());
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.symbol.elearningapp">
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.MICROPHONE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-feature android:name="android.hardware.audio.low_latency" />
<uses-feature android:name="android.hardware.audio.pro" />
<uses-feature android:name="android.hardware.microphone" />
<uses-feature
android:name="android.hardware.camera"
android:required="false" />
<uses-feature
android:name="android.hardware.camera.front"
android:required="false" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.ELearningApp"
android:usesCleartextTraffic="true">
<activity
android:name=".StudentListActivity"
android:exported="true" />
<activity
android:name=".TimerActivity"
android:exported="true" />
<activity
android:name=".JoinClassActivty"
android:exported="true" />
<activity
android:name=".TutorJoinActivity"
android:exported="true" />
<activity
android:name=".AttendenceActivity"
android:exported="true" />
<activity
android:name=".JoinActivity"
android:exported="true" />
<activity
android:name=".ClassAddActivity"
android:exported="true" />
<activity
android:name=".ClassEditActivity"
android:exported="true" />
<activity
android:name=".ClassDetailActivty"
android:exported="true" />
<activity
android:name=".HomeActivity"
android:exported="true" />
<activity
android:name=".LoginActivity"
android:exported="true" />
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
\ No newline at end of file
package com.symbol.elearningapp.Adapters;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.recyclerview.widget.RecyclerView;
import com.symbol.elearningapp.HomeActivity;
import com.symbol.elearningapp.LoginActivity;
import com.symbol.elearningapp.R;
import com.symbol.elearningapp.service.ClassDetail;
import java.util.List;
public class ClassAdapter extends RecyclerView.Adapter<ClassAdapter.ViewHolder>{
private List<ClassDetail> classDetails;
Context context;
ClickListener clickListener;
public ClassAdapter(List<ClassDetail> listdata,Context context,ClickListener clickListener) {
this.classDetails = listdata;
this.context = context;
this.clickListener =clickListener;
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext());
View listItem= layoutInflater.inflate(R.layout.list_item, parent, false);
ViewHolder viewHolder = new ViewHolder(listItem);
return viewHolder;
}
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
final ClassDetail myListData = classDetails.get(position);
holder.tvSubjectname.setText(myListData.getSubject());
holder.tvDate.setText(myListData.getDate());
holder.tvClassTime.setText(myListData.getClassTime());
holder.linearLayout.setOnClickListener(v ->{
clickListener.onItemClicked(position);
// Toast.makeText(context,myListData.getSubject() +" " +myListData.getId(),Toast.LENGTH_LONG).show();
});
}
@Override
public int getItemCount() {
return classDetails.size();
}
public static class ViewHolder extends RecyclerView.ViewHolder {
private ClickListener listener;
public TextView tvSubjectname,tvDate,tvClassTime;
public LinearLayout linearLayout;
public ViewHolder(View itemView) {
super(itemView);
tvSubjectname = (TextView) itemView.findViewById(R.id.tvSubject);
tvDate = (TextView) itemView.findViewById(R.id.tvdate);
tvClassTime = (TextView) itemView.findViewById(R.id.tvclasstime);
linearLayout = (LinearLayout)itemView.findViewById(R.id.lvitems);
}
}
public interface ClickListener {
public void onItemClicked(int position);
}
}
\ No newline at end of file
package com.symbol.elearningapp;
import androidx.appcompat.app.AppCompatActivity;
import android.app.ProgressDialog;
import android.graphics.Color;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import android.widget.TextView;
import com.symbol.elearningapp.Utils.AppPreference;
import com.symbol.elearningapp.Utils.Constant;
import com.symbol.elearningapp.service.ChartData;
import com.symbol.elearningapp.service.ClassDetail;
import com.symbol.elearningapp.service.RetrofitClient;
import com.symbol.elearningapp.service.ServiceApi;
import org.eazegraph.lib.charts.PieChart;
import org.eazegraph.lib.models.PieModel;
import java.util.Calendar;
import java.util.List;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class AttendenceActivity extends AppCompatActivity {
PieChart pieChart;
Spinner dropdown;
TextView tvsubject,tvTotal,tvAbsent,tvPresent;
ServiceApi serviceApi;
ProgressDialog progress;
AppPreference appPreference;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_attendence);
appPreference = new AppPreference(this);
serviceApi = RetrofitClient.getApiClient(Constant.baseUrl.BASE_URL).create(ServiceApi.class);
pieChart = findViewById(R.id.piechart);
dropdown = findViewById(R.id.spinner1);
tvsubject =findViewById(R.id.tvsubject);
tvTotal = findViewById(R.id.tvTotal);
tvAbsent = findViewById(R.id.tvAbsent);
tvPresent = findViewById(R.id.tvPresent);
List<ClassDetail> details= CommonData.getClassDetails();
String[] items = new String[details.size()];
for(int i = 0;i < details.size();i++)
{
items[i] = details.get(i).getSubject();
}
ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_dropdown_item, items);
dropdown.setAdapter(adapter);
dropdown.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
String subjectName = dropdown.getItemAtPosition(position).toString();
updateClassdetails(subjectName);
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
}
private void createChart(int present,int absent){
pieChart.clearChart();
pieChart.addPieSlice(
new PieModel(
"Present",
present,
Color.parseColor("#66BB6A")));
pieChart.addPieSlice(
new PieModel(
"Absent",
absent,
Color.parseColor("#EF5350")));
pieChart.startAnimation();
}
public void updateClassdetails(String subject) {
progress = new ProgressDialog(this);
progress.setTitle("Please wait");
progress.setCancelable(false);
progress.show();
Call<ChartData> userCall = serviceApi.getAttendance("atd/"+CommonData.getId()+"/"+subject);
// Call<ChartData> userCall = serviceApi.getAttendance("atd/29/"+subject);
userCall.enqueue(new Callback<ChartData>() {
@Override
public void onResponse(Call<ChartData> call, Response<ChartData> response) {
if(response.body() != null)
{
progress.dismiss();
int total = response.body().getReal();
int present =response.body().getDetected();
int absent = total-present;
createChart(present,absent);
tvsubject.setText(subject);
tvAbsent.setText(""+absent);
tvTotal.setText(""+total);
tvPresent.setText(""+present);
}
else
{
progress.dismiss();
appPreference.showToast("Server Error occured!!");
}
}
@Override
public void onFailure(Call<ChartData> call, Throwable t) {
progress.dismiss();
appPreference.showToast("Server Error occured!!");
}
});
}
}
package com.symbol.elearningapp;
import androidx.appcompat.app.AppCompatActivity;
import android.app.DatePickerDialog;
import android.app.ProgressDialog;
import android.app.TimePickerDialog;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.TimePicker;
import com.symbol.elearningapp.Utils.AppPreference;
import com.symbol.elearningapp.Utils.Constant;
import com.symbol.elearningapp.service.ClassDetail;
import com.symbol.elearningapp.service.RetrofitClient;
import com.symbol.elearningapp.service.ServiceApi;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.List;
import java.util.Locale;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class ClassAddActivity extends AppCompatActivity {
Calendar myCalendar;
EditText etdate, etclasstime, etsubject;
Button addBtn;
ServiceApi serviceApi;
AppPreference appPreference;
ProgressDialog progress;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_class_add);
myCalendar = Calendar.getInstance();
serviceApi = RetrofitClient.getApiClient(Constant.baseUrl.BASE_URL).create(ServiceApi.class);
appPreference = new AppPreference(this);
etdate = (EditText) findViewById(R.id.etdate);
etclasstime = (EditText) findViewById(R.id.etclasstime);
etsubject = (EditText) findViewById(R.id.etsubject);
addBtn = findViewById(R.id.btn_add);
DatePickerDialog.OnDateSetListener date = new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year, int monthOfYear,
int dayOfMonth) {
myCalendar.set(Calendar.YEAR, year);
myCalendar.set(Calendar.MONTH, monthOfYear);
myCalendar.set(Calendar.DAY_OF_MONTH, dayOfMonth);
updateLabel();
}
};
etdate.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
new DatePickerDialog(ClassAddActivity.this, date, myCalendar
.get(Calendar.YEAR), myCalendar.get(Calendar.MONTH),
myCalendar.get(Calendar.DAY_OF_MONTH)).show();
}
});
etclasstime.setOnClickListener(new View.OnClickListener() {
final Calendar c = Calendar.getInstance();
int mHour = c.get(Calendar.HOUR_OF_DAY);
int mMinute = c.get(Calendar.MINUTE);
@Override
public void onClick(View v) {
TimePickerDialog timePickerDialog = new TimePickerDialog(ClassAddActivity.this,
new TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(TimePicker view, int hourOfDay,
int minute) {
etclasstime.setText(hourOfDay + ":" + String.format("%02d", minute));
}
}, mHour, mMinute, true);
timePickerDialog.show();
}
});
addBtn.setOnClickListener(view -> {
addClassdetails();
});
}
public void addClassdetails() {
progress = new ProgressDialog(this);
progress.setTitle("Please wait");
progress.setCancelable(false);
progress.show();
String Subject = etsubject.getText().toString();
String Date = etdate.getText().toString();
String time = etclasstime.getText().toString();
if (TextUtils.isEmpty(Subject)) {
appPreference.showToast("Subject name is required.");
} else if (TextUtils.isEmpty(Date)) {
appPreference.showToast("Please select the date");
} else if (TextUtils.isEmpty(time)) {
appPreference.showToast("Please select the time");
} else {
int id = Integer.parseInt(CommonData.getClassDetails().get(CommonData.getClassDetails().size() - 1).getId()) + 1;
Call<ClassDetail> userCall = serviceApi.addClassDetail(new ClassDetail("" + id, Subject, Date, time, null));
userCall.enqueue(new Callback<ClassDetail>() {
@Override
public void onResponse(Call<ClassDetail> call, Response<ClassDetail> response) {
if (!response.equals("")) {
progress.dismiss();
appPreference.showToast("Added Sucessfully!!");
stopActivity();
} else {
progress.dismiss();
appPreference.showToast("Server Error occured!!");
}
}
@Override
public void onFailure(Call<ClassDetail> call, Throwable t) {
progress.dismiss();
appPreference.showToast(t.getMessage());
}
});
}
}
private void updateLabel() {
String myFormat = "MM/dd/yy";
SimpleDateFormat sdf = new SimpleDateFormat(myFormat, Locale.US);
etdate.setText(sdf.format(myCalendar.getTime()));
}
private void stopActivity() {
this.finish();
}
}
\ No newline at end of file
package com.symbol.elearningapp;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import com.symbol.elearningapp.Adapters.ClassAdapter;
import com.symbol.elearningapp.Utils.AppPreference;
import com.symbol.elearningapp.Utils.Constant;
import com.symbol.elearningapp.service.ClassDetail;
import com.symbol.elearningapp.service.RetrofitClient;
import com.symbol.elearningapp.service.ServiceApi;
import java.util.List;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class ClassDetailActivty extends AppCompatActivity implements ClassAdapter.ClickListener {
AppPreference appPreference;
Button addBtn;
ServiceApi serviceApi;
RecyclerView recyclerView;
ClassAdapter adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_class_detail_activty);
appPreference = new AppPreference(this);
addBtn = findViewById(R.id.btn_add);
serviceApi = RetrofitClient.getApiClient(Constant.baseUrl.BASE_URL).create(ServiceApi.class);
if (CommonData.getType().equals("student")) {
addBtn.setVisibility(View.INVISIBLE);
}
addBtn.setOnClickListener(v -> {
Intent intent = new Intent(ClassDetailActivty.this, ClassAddActivity.class);
startActivity(intent);
this.finish();
});
recyclerView = (RecyclerView) findViewById(R.id.rvDetails);
adapter = new ClassAdapter(CommonData.getClassDetails(), this, this);
recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setAdapter(adapter);
}
@Override
public void onItemClicked(int position) {
if (!CommonData.getType().equals("student")) {
CommonData.setSelectedIndex(position);
Intent intent = new Intent(ClassDetailActivty.this, ClassEditActivity.class);
startActivity(intent);
this.finish();
}
}
public void getClassdetails(){
Call<List<ClassDetail>> userCall = serviceApi.classDetails();
userCall.enqueue(new Callback<List<ClassDetail>>() {
@Override
public void onResponse(Call<List<ClassDetail>> call, Response<List<ClassDetail>> response) {
if (!response.body().equals("")) {
CommonData.setClassDetails(response.body());
}
else {
appPreference.showToast("Server Error occured!!");
}
}
@Override
public void onFailure(Call<List<ClassDetail>> call, Throwable t) {
appPreference.showToast(t.getMessage());
}
});
}
@Override
protected void onResume() {
super.onResume();
// getClassdetails();
// adapter.notifyDataSetChanged();
}
}
\ No newline at end of file
package com.symbol.elearningapp;
import androidx.appcompat.app.AppCompatActivity;
import android.app.DatePickerDialog;
import android.app.ProgressDialog;
import android.app.TimePickerDialog;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.TimePicker;
import com.symbol.elearningapp.Utils.AppPreference;
import com.symbol.elearningapp.Utils.Constant;
import com.symbol.elearningapp.service.ClassDetail;
import com.symbol.elearningapp.service.RetrofitClient;
import com.symbol.elearningapp.service.ServiceApi;
import com.symbol.elearningapp.service.StudentDetails;
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 retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class ClassEditActivity extends AppCompatActivity {
AppPreference appPreference;
Calendar myCalendar;
EditText etSubject, etDate, etTime;
Button btnDel, btnEdit,btnAdd;
int selectedIndex;
ServiceApi serviceApi;
ProgressDialog progress;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_class_edit);
appPreference = new AppPreference(this);
serviceApi = RetrofitClient.getApiClient(Constant.baseUrl.BASE_URL).create(ServiceApi.class);
etDate = findViewById(R.id.etdate1);
etSubject = findViewById(R.id.etsubject1);
etTime = findViewById(R.id.etclasstime1);
btnDel = findViewById(R.id.btn_Delete);
btnEdit = findViewById(R.id.btn_edit);
btnAdd = findViewById(R.id.btn_add);
selectedIndex = CommonData.getSelectedIndex();
etDate.setText(CommonData.getClassDetails().get(selectedIndex).getDate());
etSubject.setText(CommonData.getClassDetails().get(selectedIndex).getSubject());
etTime.setText(CommonData.getClassDetails().get(selectedIndex).getClassTime());
btnEdit.setOnClickListener(view -> {
updateClassdetails();
});
btnDel.setOnClickListener(view -> {
deleteClassdetails();
});
btnAdd.setOnClickListener(v -> {
getStudentList();
});
myCalendar = Calendar.getInstance();
DatePickerDialog.OnDateSetListener date = new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year, int monthOfYear,
int dayOfMonth) {
myCalendar.set(Calendar.YEAR, year);
myCalendar.set(Calendar.MONTH, monthOfYear);
myCalendar.set(Calendar.DAY_OF_MONTH, dayOfMonth);
updateLabel();
}
};
etDate.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new DatePickerDialog(ClassEditActivity.this, date, myCalendar
.get(Calendar.YEAR), myCalendar.get(Calendar.MONTH),
myCalendar.get(Calendar.DAY_OF_MONTH)).show();
}
});
etTime.setOnClickListener(new View.OnClickListener() {
final Calendar c = Calendar.getInstance();
int mHour = c.get(Calendar.HOUR_OF_DAY);
int mMinute = c.get(Calendar.MINUTE);
@Override
public void onClick(View v) {
TimePickerDialog timePickerDialog = new TimePickerDialog(ClassEditActivity.this,
new TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(TimePicker view, int hourOfDay,
int minute) {
etTime.setText(hourOfDay + ":" + String.format("%02d", minute));
}
}, mHour, mMinute, true);
timePickerDialog.show();
}
});
}
private void updateLabel() {
String myFormat = "MM/dd/yy";
SimpleDateFormat sdf = new SimpleDateFormat(myFormat, Locale.US);
etDate.setText(sdf.format(myCalendar.getTime()));
}
public void deleteClassdetails() {
progress = new ProgressDialog(this);
progress.setTitle("Please wait");
progress.setCancelable(false);
progress.show();
Call<String> userCall = serviceApi.deleteUser(CommonData.getClassDetails().get(CommonData.getSelectedIndex()).getId());
userCall.enqueue(new Callback<String>() {
@Override
public void onResponse(Call<String> call, Response<String> response) {
if (response.code()==200) {
progress.dismiss();
appPreference.showToast("deleted Sucessfully");
stopActivity();
} else {
appPreference.showToast("Server Error occured!!");
}
}
@Override
public void onFailure(Call<String> call, Throwable t) {
appPreference.showToast(t.getMessage());
}
});
}
public void getStudentList() {
progress = new ProgressDialog(this);
progress.setTitle("Please wait");
progress.setCancelable(false);
progress.show();
Call<List<StudentDetails>> userCall = serviceApi.getStudents("class/students");
userCall.enqueue(new Callback<List<StudentDetails>>() {
@Override
public void onResponse(Call<List<StudentDetails>> call, Response<List<StudentDetails>> response) {
if (response.body()!=null)
{
CommonData.setStudentDetailsList(response.body());
CommonData.setStudentDetailsHashMap(new HashMap<>());
CommonData.setStudentDetailsHashMap(new HashMap<>());
for(StudentDetails details : CommonData.getStudentDetailsList()){
CommonData.getStudentDetailsHashMap().put(details.getStudentName(),details);
}
progress.dismiss();
Intent intent = new Intent(ClassEditActivity.this, StudentListActivity.class);
intent.putExtra("key", "edit");
startActivity(intent);
}
else
{
appPreference.showToast("Server Error occured!!");
}
}
@Override
public void onFailure(Call<List<StudentDetails>> call, Throwable t) {
appPreference.showToast(t.getMessage());
progress.dismiss();
}
});
}
public void updateClassdetails() {
progress = new ProgressDialog(this);
progress.setTitle("Please wait");
progress.setCancelable(false);
progress.show();
String Subject = etSubject.getText().toString();
String Date = etDate.getText().toString();
String time = etTime.getText().toString();
List<StudentDetails> listStudentDetails = new ArrayList<>();
if (CommonData.getSelectedStudentDetailsHashMap()!= null) {
for(Map.Entry<String, StudentDetails> entry : CommonData.getSelectedStudentDetailsHashMap().entrySet()) {
StudentDetails value = entry.getValue();
listStudentDetails.add(value);
}
}
if (TextUtils.isEmpty(Subject)) {
appPreference.showToast("Subject name is required.");
} else if (TextUtils.isEmpty(Date)) {
appPreference.showToast("Please select the date");
} else if (TextUtils.isEmpty(time)) {
appPreference.showToast("Please select the time");
} else {
Call<String> userCall = serviceApi.updateUser(new ClassDetail(CommonData.getClassDetails().get(CommonData.getSelectedIndex()).getId(), Subject, Date, time, listStudentDetails));
userCall.enqueue(new Callback<String>() {
@Override
public void onResponse(Call<String> call, Response<String> response) {
if (response.body().equals("ok")) {
progress.dismiss();
appPreference.showToast("updated Sucessfully");
stopActivity();
} else {
appPreference.showToast("Server Error occured!!");
}
}
@Override
public void onFailure(Call<String> call, Throwable t) {
appPreference.showToast(t.getMessage());
}
});
}
}
private void stopActivity(){
this.finish();
}
}
\ No newline at end of file
package com.symbol.elearningapp;
import androidx.appcompat.app.AppCompatActivity;
import com.symbol.elearningapp.service.ClassDetail;
import com.symbol.elearningapp.service.StudentDetails;
import java.util.HashMap;
import java.util.List;
public class CommonData{
public static List<ClassDetail> classDetails;
public static String name;
public static String type;
public static int selectedIndex;
public static String id;
public static List<StudentDetails> studentDetailsList;
public static HashMap<String, StudentDetails> studentDetailsHashMap;
public static HashMap<String, StudentDetails> selectedStudentDetailsHashMap;
public static HashMap<String, StudentDetails> getSelectedStudentDetailsHashMap() {
return selectedStudentDetailsHashMap;
}
public static void setSelectedStudentDetailsHashMap(HashMap<String, StudentDetails> selectedStudentDetailsHashMap) {
CommonData.selectedStudentDetailsHashMap = selectedStudentDetailsHashMap;
}
public static HashMap<String, StudentDetails> getStudentDetailsHashMap() {
return studentDetailsHashMap;
}
public static void setStudentDetailsHashMap(HashMap<String, StudentDetails> studentDetailsHashMap) {
CommonData.studentDetailsHashMap = studentDetailsHashMap;
}
public static List<StudentDetails> getStudentDetailsList() {
return studentDetailsList;
}
public static void setStudentDetailsList(List<StudentDetails> studentDetailsList) {
CommonData.studentDetailsList = studentDetailsList;
}
public static String getId() {
return id;
}
public static void setId(String id) {
CommonData.id = id;
}
public static int getSelectedIndex() {
return selectedIndex;
}
public static void setSelectedIndex(int selectedIndex) {
CommonData.selectedIndex = selectedIndex;
}
public static List<ClassDetail> getClassDetails() {
return classDetails;
}
public static void setClassDetails(List<ClassDetail> classDetails) {
CommonData.classDetails = classDetails;
}
public static String getType() {
return type;
}
public static void setType(String type) {
CommonData.type = type;
}
public static void setName(String name) {
CommonData.name = name;
}
public static String getName() {
return name;
}
}
package com.symbol.elearningapp;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import android.Manifest;
import android.app.ProgressDialog;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.Toast;
import com.symbol.elearningapp.Utils.AppPreference;
import com.symbol.elearningapp.Utils.Constant;
import com.symbol.elearningapp.service.ClassDetail;
import com.symbol.elearningapp.service.RetrofitClient;
import com.symbol.elearningapp.service.ServiceApi;
import com.symbol.elearningapp.service.StudentDetails;
import com.symbol.elearningapp.service.User;
import java.util.HashMap;
import java.util.List;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class HomeActivity extends AppCompatActivity {
LinearLayout ll1, ll2, ll3, ll4;
ImageView iv1, iv2, iv3, iv4;
Button bt1, bt2, bt3, bt4;
String type = "student";
AppPreference appPreference;
ServiceApi serviceApi;
ProgressDialog progress;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
type = CommonData.getType();
serviceApi = RetrofitClient.getApiClient(Constant.baseUrl.BASE_URL).create(ServiceApi.class);
appPreference = new AppPreference(this);
if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA}, 1);
Toast.makeText(this, " Please Grant Permission for Camera", Toast.LENGTH_SHORT).show();
} else if (ActivityCompat.checkSelfPermission(this, Manifest.permission.MODIFY_AUDIO_SETTINGS) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.MODIFY_AUDIO_SETTINGS}, 1);
Toast.makeText(this, " Please Grant Permission for Camera", Toast.LENGTH_SHORT).show();
}
ll1 = findViewById(R.id.llbutton1);
ll2 = findViewById(R.id.llbutton2);
ll3 = findViewById(R.id.llbutton3);
ll4 = findViewById(R.id.llbutton4);
iv1 = findViewById(R.id.ivbutton1);
iv2 = findViewById(R.id.ivbutton2);
iv3 = findViewById(R.id.ivbutton3);
iv4 = findViewById(R.id.ivbutton4);
bt1 = findViewById(R.id.ttbutton1);
bt2 = findViewById(R.id.ttbutton2);
bt3 = findViewById(R.id.ttbutton3);
bt4 = findViewById(R.id.ttbutton4);
populateUI();
}
public void getClassdetails() {
progress = new ProgressDialog(this);
progress.setTitle("Please wait");
progress.setCancelable(false);
progress.show();
Call<List<ClassDetail>> userCall = serviceApi.classDetails();
userCall.enqueue(new Callback<List<ClassDetail>>() {
@Override
public void onResponse(Call<List<ClassDetail>> call, Response<List<ClassDetail>> response) {
if (!response.body().equals("")) {
CommonData.setClassDetails(response.body());
progress.dismiss();
Intent intent = new Intent(HomeActivity.this, ClassDetailActivty.class);
startActivity(intent);
} else {
appPreference.showToast("Server Error occured!!");
}
}
@Override
public void onFailure(Call<List<ClassDetail>> call, Throwable t) {
appPreference.showToast(t.getMessage());
progress.dismiss();
}
});
}
public void getClassjoindetails() {
progress = new ProgressDialog(this);
progress.setTitle("Please wait");
progress.setCancelable(false);
progress.show();
Call<List<ClassDetail>> userCall = serviceApi.classDetails();
userCall.enqueue(new Callback<List<ClassDetail>>() {
@Override
public void onResponse(Call<List<ClassDetail>> call, Response<List<ClassDetail>> response) {
if (!response.body().equals("")) {
CommonData.setClassDetails(response.body());
progress.dismiss();
Intent intent = new Intent(HomeActivity.this, JoinClassActivty.class);
startActivity(intent);
} else {
appPreference.showToast("Server Error occured!!");
}
}
@Override
public void onFailure(Call<List<ClassDetail>> call, Throwable t) {
appPreference.showToast(t.getMessage());
progress.dismiss();
}
});
}
public void getAttendanceActivity() {
progress = new ProgressDialog(this);
progress.setTitle("Please wait");
progress.setCancelable(false);
progress.show();
Call<List<ClassDetail>> userCall = serviceApi.classDetails();
userCall.enqueue(new Callback<List<ClassDetail>>() {
@Override
public void onResponse(Call<List<ClassDetail>> call, Response<List<ClassDetail>> response) {
if (!response.body().equals("")) {
CommonData.setClassDetails(response.body());
progress.dismiss();
Intent intent = new Intent(HomeActivity.this, AttendenceActivity.class);
startActivity(intent);
} else {
appPreference.showToast("Server Error occured!!");
}
}
@Override
public void onFailure(Call<List<ClassDetail>> call, Throwable t) {
appPreference.showToast(t.getMessage());
progress.dismiss();
}
});
}
public void getStudentList() {
progress = new ProgressDialog(this);
progress.setTitle("Please wait");
progress.setCancelable(false);
progress.show();
Call<List<StudentDetails>> userCall = serviceApi.getStudents("class/students");
userCall.enqueue(new Callback<List<StudentDetails>>() {
@Override
public void onResponse(Call<List<StudentDetails>> call, Response<List<StudentDetails>> response) {
if (response.body()!=null)
{
CommonData.setStudentDetailsList(response.body());
CommonData.setStudentDetailsHashMap(new HashMap<>());
CommonData.setStudentDetailsHashMap(new HashMap<>());
for(StudentDetails details : CommonData.getStudentDetailsList()){
CommonData.getStudentDetailsHashMap().put(details.getStudentName(),details);
}
progress.dismiss();
Intent intent = new Intent(HomeActivity.this, StudentListActivity.class);
intent.putExtra("key", "home");
startActivity(intent);
}
else
{
appPreference.showToast("Server Error occured!!");
}
}
@Override
public void onFailure(Call<List<StudentDetails>> call, Throwable t) {
appPreference.showToast(t.getMessage());
progress.dismiss();
}
});
}
public void populateUI() {
if (type.equals("student")) {
ll1.setVisibility(View.VISIBLE);
ll2.setVisibility(View.VISIBLE);
ll3.setVisibility(View.VISIBLE);
ll4.setVisibility(View.INVISIBLE);
iv1.setBackgroundResource(R.drawable.classlogo);
iv2.setBackgroundResource(R.drawable.attendancelogo);
iv3.setBackgroundResource(R.drawable.joinlogo);
bt1.setText("Class Details");
bt2.setText("Attendance");
bt3.setText("Join");
bt1.setOnClickListener(v -> {
getClassdetails();
});
bt2.setOnClickListener(v -> {
getAttendanceActivity();
});
bt3.setOnClickListener(v -> {
getClassjoindetails();
});
} else {
ll1.setVisibility(View.VISIBLE);
ll2.setVisibility(View.VISIBLE);
ll3.setVisibility(View.VISIBLE);
ll4.setVisibility(View.INVISIBLE);
iv1.setBackgroundResource(R.drawable.classlogo);
iv2.setBackgroundResource(R.drawable.attendancelogo);
iv3.setBackgroundResource(R.drawable.joinlogo);
bt1.setText("Class Details");
bt2.setText("Students");
bt3.setText("Start Session");
bt1.setOnClickListener(v -> {
getClassdetails();
});
bt2.setOnClickListener(v -> {
getStudentList();
});
bt3.setOnClickListener(v -> {
getClassjoindetails();
});
}
}
}
\ No newline at end of file
package com.symbol.elearningapp;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.symbol.elearningapp.Adapters.ClassAdapter;
import com.symbol.elearningapp.Utils.AppPreference;
import com.symbol.elearningapp.Utils.Constant;
import com.symbol.elearningapp.service.ClassDetail;
import com.symbol.elearningapp.service.RetrofitClient;
import com.symbol.elearningapp.service.ServiceApi;
import java.util.List;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class JoinClassActivty extends AppCompatActivity implements ClassAdapter.ClickListener {
AppPreference appPreference;
Button addBtn;
ServiceApi serviceApi;
RecyclerView recyclerView;
ClassAdapter adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_class_detail_activty);
appPreference = new AppPreference(this);
addBtn = findViewById(R.id.btn_add);
serviceApi = RetrofitClient.getApiClient(Constant.baseUrl.BASE_URL).create(ServiceApi.class);
addBtn.setVisibility(View.INVISIBLE);
addBtn.setOnClickListener(v -> {
Intent intent = new Intent(JoinClassActivty.this, ClassAddActivity.class);
startActivity(intent);
this.finish();
});
recyclerView = (RecyclerView) findViewById(R.id.rvDetails);
adapter = new ClassAdapter(CommonData.getClassDetails(), this, this);
recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setAdapter(adapter);
}
@Override
public void onItemClicked(int position) {
CommonData.setSelectedIndex(position);
Intent intent = new Intent(JoinClassActivty.this, JoinActivity.class);
startActivity(intent);
this.finish();
}
public void getClassdetails(){
Call<List<ClassDetail>> userCall = serviceApi.classDetails();
userCall.enqueue(new Callback<List<ClassDetail>>() {
@Override
public void onResponse(Call<List<ClassDetail>> call, Response<List<ClassDetail>> response) {
if (!response.body().equals("")) {
CommonData.setClassDetails(response.body());
}
else {
appPreference.showToast("Server Error occured!!");
}
}
@Override
public void onFailure(Call<List<ClassDetail>> call, Throwable t) {
appPreference.showToast(t.getMessage());
}
});
}
@Override
protected void onResume() {
super.onResume();
// getClassdetails();
// adapter.notifyDataSetChanged();
}
}
\ No newline at end of file
package com.symbol.elearningapp;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.AppCompatImageView;
import androidx.core.content.ContextCompat;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.widget.Button;
import android.widget.TextView;
import com.symbol.elearningapp.Utils.AppPreference;
import com.symbol.elearningapp.Utils.Constant;
import com.symbol.elearningapp.service.RetrofitClient;
import com.symbol.elearningapp.service.ServiceApi;
import com.symbol.elearningapp.service.User;
import java.sql.SQLOutput;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class LoginActivity extends AppCompatActivity {
Button loginButton;
AppCompatImageView ivStudent, ivTutor;
TextView tvPWD, tvUserName;
ServiceApi serviceApi;
AppPreference appPreference;
String type = "student";
ProgressDialog progress;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
serviceApi = RetrofitClient.getApiClient(Constant.baseUrl.BASE_URL).create(ServiceApi.class);
appPreference = new AppPreference(this);
loginButton = findViewById(R.id.btn_login);
ivStudent = findViewById(R.id.iv_student);
ivTutor = findViewById(R.id.iv_teacher);
tvPWD = findViewById(R.id.tvPWD);
tvUserName = findViewById(R.id.tvUserName);
ivStudent.setOnClickListener(View -> {
type = "student";
ivStudent.setBackground(ContextCompat.getDrawable(this, R.drawable.darkgrey_back_curved));
ivTutor.setBackground(ContextCompat.getDrawable(this, R.drawable.grey_back_curved));
});
ivTutor.setOnClickListener(View -> {
type = "tutor";
ivTutor.setBackground(ContextCompat.getDrawable(this, R.drawable.darkgrey_back_curved));
ivStudent.setBackground(ContextCompat.getDrawable(this, R.drawable.grey_back_curved));
});
loginButton.setOnClickListener(View -> {
userLogin();
});
}
public void userLogin() {
progress = new ProgressDialog(this);
progress.setTitle("Please wait");
progress.setCancelable(false);
progress.show();
String userName = tvUserName.getText().toString();
String Password = tvPWD.getText().toString();
if (TextUtils.isEmpty(userName)) {
appPreference.showToast("Username is required.");
} else if (TextUtils.isEmpty(Password)) {
appPreference.showToast("Password required");
} else {
// Call<String> userCall = serviceApi.login(new User(type, "bandara.p@gmail.com", "Bandara@123"));
Call<String> userCall = serviceApi.login(new User(type, userName,Password));
userCall.enqueue(new Callback<String>() {
@Override
public void onResponse(Call<String> call, Response<String> response) {
String responseString = response.body().toString();
String[] splitStr = responseString.split("\\s+");
if (splitStr[0].equals("student")) {
CommonData.setType("student");
CommonData.setId(splitStr[1]);
Intent intent = new Intent(LoginActivity.this, HomeActivity.class);
startActivity(intent);
progress.dismiss();
tvUserName.setText("");
tvPWD.setText("");
}
else if (splitStr[0].equals("tutor")) {
CommonData.setType("tutor");
CommonData.setId(splitStr[1]);
Intent intent = new Intent(LoginActivity.this, HomeActivity.class);
startActivity(intent);
progress.dismiss();
tvUserName.setText("");
tvPWD.setText("");
}
else {
appPreference.showToast(response.body());
}
}
@Override
public void onFailure(Call<String> call, Throwable t) {
appPreference.showToast("Server Error.!");
progress.dismiss();
}
});
}
}
}
\ No newline at end of file
package com.symbol.elearningapp;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.LinearLayout;
public class MainActivity extends AppCompatActivity {
ImageView mLogo;
LinearLayout descimage,desctxt;
Animation uptodown,downtoup;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
descimage = (LinearLayout) findViewById(R.id.titleimage);
desctxt = (LinearLayout) findViewById(R.id.titletxt);
mLogo =findViewById(R.id.imageView2);
uptodown = AnimationUtils.loadAnimation(this,R.anim.uptodown);
downtoup = AnimationUtils.loadAnimation(this,R.anim.downtoup);
descimage.setAnimation(uptodown);
desctxt.setAnimation(downtoup);
Thread myThread = new Thread(){
@Override
public void run(){
try {
sleep(5000);
Intent intent = new Intent(getApplicationContext(),LoginActivity.class);
startActivity(intent);
finish();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
};
myThread.start();
}
}
package com.symbol.elearningapp;
import androidx.appcompat.app.AppCompatActivity;
import android.app.SearchManager;
import android.database.Cursor;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.SearchView;
import android.widget.Toast;
import com.symbol.elearningapp.service.StudentDetails;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class StudentListActivity extends AppCompatActivity {
SearchView searchView;
ListView listView;
ArrayList<String> list;
ArrayAdapter<String> adapter;
HashMap<String, StudentDetails> selectedStudentDetailsHashMap;
String passedValue;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_student_list);
if (getIntent().getExtras() != null) {
passedValue = getIntent().getStringExtra("key");
}
searchView = (SearchView) findViewById(R.id.searchView);
listView = (ListView) findViewById(R.id.lv1);
selectedStudentDetailsHashMap = new HashMap<>();
list = new ArrayList<>();
for(StudentDetails details : CommonData.getStudentDetailsList()){
list.add(details.getStudentName());
}
adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,list);
listView.setAdapter(adapter);
listView.setOnItemClickListener((adapterView, view, i, l) -> {
if(passedValue.equals("edit")){
String s = listView.getItemAtPosition(i).toString();
setStudentList(s);
}
// If you want to close the adapter
});
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
if(list.contains(query)){
adapter.getFilter().filter(query);
}else{
Toast.makeText(StudentListActivity.this, "No Match found",Toast.LENGTH_LONG).show();
}
return false;
}
@Override
public boolean onQueryTextChange(String newText) {
adapter.getFilter().filter(newText);
return false;
}
});
if(passedValue.equals("edit")){
if(CommonData.getClassDetails().get(CommonData.getSelectedIndex()).getListStd() != null){
for(StudentDetails studentDetails :CommonData.getClassDetails().get(CommonData.getSelectedIndex()).getListStd()){
selectedStudentDetailsHashMap.put(studentDetails.getStudentName(),studentDetails);
}
}
}
}
public void setStudentList(String name){
boolean alreadyNotAdded = true;
if (CommonData.getSelectedStudentDetailsHashMap()!=null) {
for(Map.Entry<String, StudentDetails> entry : CommonData.getSelectedStudentDetailsHashMap().entrySet()) {
String key = entry.getKey();
if(name.equals(key)){
alreadyNotAdded = false;
}
}
}
else if(selectedStudentDetailsHashMap!=null){
for(Map.Entry<String, StudentDetails> entry : selectedStudentDetailsHashMap.entrySet()) {
String key = entry.getKey();
if(name.equals(key)){
alreadyNotAdded = false;
}
}
}
if(alreadyNotAdded)
{
for(Map.Entry<String, StudentDetails> entry : CommonData.getStudentDetailsHashMap().entrySet()) {
String key = entry.getKey();
StudentDetails value = entry.getValue();
if(name.equals(key)){
selectedStudentDetailsHashMap.put(key,value);
}
}
Toast.makeText(StudentListActivity.this, "Added sucessfully",Toast.LENGTH_LONG).show();
}
else
{
Toast.makeText(StudentListActivity.this, "Already added",Toast.LENGTH_LONG).show();
}
}
@Override
public void onBackPressed() {
super.onBackPressed();
if(passedValue.equals("edit")){
CommonData.setSelectedStudentDetailsHashMap(selectedStudentDetailsHashMap);
}
}
}
\ No newline at end of file
package com.symbol.elearningapp;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.TextView;
import java.util.Locale;
public class TimerActivity extends AppCompatActivity {
// before the activity was paused.
// Number of seconds displayed
// on the stopwatch.
private int seconds = 0;
// Is the stopwatch running?
private boolean running;
private boolean wasRunning;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_timer);
if (savedInstanceState != null) {
// Get the previous state of the stopwatch
// if the activity has been
// destroyed and recreated.
seconds
= savedInstanceState
.getInt("seconds");
running
= savedInstanceState
.getBoolean("running");
wasRunning
= savedInstanceState
.getBoolean("wasRunning");
}
runTimer();
}
// Save the state of the stopwatch
// if it's about to be destroyed.
@Override
public void onSaveInstanceState(
Bundle savedInstanceState) {
super.onSaveInstanceState(savedInstanceState);
savedInstanceState
.putInt("seconds", seconds);
savedInstanceState
.putBoolean("running", running);
savedInstanceState
.putBoolean("wasRunning", wasRunning);
}
// If the activity is paused,
// stop the stopwatch.
@Override
protected void onPause()
{
super.onPause();
wasRunning = running;
running = false;
}
// If the activity is resumed,
// start the stopwatch
// again if it was running previously.
@Override
protected void onResume()
{
super.onResume();
if (wasRunning) {
running = true;
}
}
// Start the stopwatch running
// when the Start button is clicked.
// Below method gets called
// when the Start button is clicked.
public void onClickStart(View view)
{
running = true;
}
// Stop the stopwatch running
// when the Stop button is clicked.
// Below method gets called
// when the Stop button is clicked.
public void onClickStop(View view)
{
running = false;
}
// Reset the stopwatch when
// the Reset button is clicked.
// Below method gets called
// when the Reset button is clicked.
public void onClickReset(View view)
{
running = false;
seconds = 0;
}
// Sets the NUmber of seconds on the timer.
// The runTimer() method uses a Handler
// to increment the seconds and
// update the text view.
private void runTimer()
{
// Get the text view.
final TextView timeView
= (TextView)findViewById(
R.id.time_view);
// Creates a new Handler
final Handler handler
= new Handler();
// Call the post() method,
// passing in a new Runnable.
// The post() method processes
// code without a delay,
// so the code in the Runnable
// will run almost immediately.
handler.post(new Runnable() {
@Override
public void run()
{
int hours = seconds / 3600;
int minutes = (seconds % 3600) / 60;
int secs = seconds % 60;
// Format the seconds into hours, minutes,
// and seconds.
String time
= String
.format(Locale.getDefault(),
"%d:%02d:%02d", hours,
minutes, secs);
// Set the text view text.
timeView.setText(time);
// If running is true, increment the
// seconds variable.
if (running) {
seconds++;
}
// Post the code again
// with a delay of 1 second.
handler.postDelayed(this, 1000);
}
});
}
}
package com.symbol.elearningapp;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.camera.core.Camera;
import androidx.camera.core.CameraSelector;
import androidx.camera.core.ImageAnalysis;
import androidx.camera.core.ImageCapture;
import androidx.camera.core.Preview;
import androidx.camera.extensions.HdrImageCaptureExtender;
import androidx.camera.lifecycle.ProcessCameraProvider;
import androidx.camera.view.PreviewView;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.lifecycle.LifecycleOwner;
import android.Manifest;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.view.SurfaceView;
import android.widget.Toast;
import com.google.common.util.concurrent.ListenableFuture;
import java.util.concurrent.ExecutionException;
public class TutorJoinActivity extends AppCompatActivity {
SurfaceView surfaceView;
PreviewView mPreviewView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tutor_join);
mPreviewView = findViewById(R.id.previewView);
if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA}, 1);
Toast.makeText(this, "Grant Permission and restart app", Toast.LENGTH_SHORT).show();
} else {
startCamera();
}
}
private void startCamera() {
final ListenableFuture<ProcessCameraProvider> cameraProviderFuture = ProcessCameraProvider.getInstance(this);
cameraProviderFuture.addListener(new Runnable() {
@Override
public void run() {
try {
ProcessCameraProvider cameraProvider = cameraProviderFuture.get();
bindPreview(cameraProvider);
} catch (ExecutionException | InterruptedException e) {
// No errors need to be handled for this Future.
// This should never be reached.
}
}
}, ContextCompat.getMainExecutor(this));
}
void bindPreview(@NonNull ProcessCameraProvider cameraProvider) {
Preview preview = new Preview.Builder()
.build();
CameraSelector cameraSelector = new CameraSelector.Builder()
.requireLensFacing(CameraSelector.LENS_FACING_FRONT)
.build();
ImageAnalysis imageAnalysis = new ImageAnalysis.Builder()
.build();
ImageCapture.Builder builder = new ImageCapture.Builder();
HdrImageCaptureExtender hdrImageCaptureExtender = HdrImageCaptureExtender.create(builder);
if (hdrImageCaptureExtender.isExtensionAvailable(cameraSelector)) {
hdrImageCaptureExtender.enableExtension(cameraSelector);
}
final ImageCapture imageCapture = builder
.setTargetRotation(this.getWindowManager().getDefaultDisplay().getRotation())
.build();
preview.setSurfaceProvider(mPreviewView.createSurfaceProvider());
Camera camera = cameraProvider.bindToLifecycle((LifecycleOwner) this, cameraSelector, preview, imageAnalysis, imageCapture);
}
}
\ No newline at end of file
package com.symbol.elearningapp.Utils;
import android.content.Context;
import android.content.SharedPreferences;
import android.widget.Toast;
import com.symbol.elearningapp.R;
public class AppPreference {
private SharedPreferences sharedPreferences;
private SharedPreferences.Editor editor;
private Context context;
public AppPreference(Context context){
this.context = context;
sharedPreferences = context.getSharedPreferences(String.valueOf(R.string.s_pref_file), Context.MODE_PRIVATE);
editor = sharedPreferences.edit();
}
public void showToast(String message){
Toast.makeText(context, message, Toast.LENGTH_LONG).show();
}
public void settype(String name){
editor.putString(String.valueOf(R.string.s_pref_type), name);
editor.commit();
}
public String gettype(){
return sharedPreferences.getString(String.valueOf(R.string.s_pref_type), "user");
}
}
\ No newline at end of file
package com.symbol.elearningapp.Utils;
public class Constant {
public static class baseUrl {
public final static String BASE_URL = "https://e-education600.herokuapp.com";
}
}
package com.symbol.elearningapp.service;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class AttendanceDetail {
@SerializedName("userId")
@Expose
private String userId;
@SerializedName("detectedTime")
@Expose
private String detectedTime;
@SerializedName("fullTime")
@Expose
private String fullTime;
@SerializedName("subject")
@Expose
private String subject;
public AttendanceDetail(String userId, String detectedTime, String fullTime, String subject) {
this.userId = userId;
this.detectedTime = detectedTime;
this.fullTime = fullTime;
this.subject = subject;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getDetectedTime() {
return detectedTime;
}
public void setDetectedTime(String detectedTime) {
this.detectedTime = detectedTime;
}
public String getFullTime() {
return fullTime;
}
public void setFullTime(String fullTime) {
this.fullTime = fullTime;
}
public String getSubject() {
return subject;
}
public void setSuject(String suject) {
this.subject = suject;
}
}
package com.symbol.elearningapp.service;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class ChartData {
@SerializedName("real")
@Expose
private Integer real;
@SerializedName("detected")
@Expose
private Integer detected;
public Integer getReal() {
return real;
}
public void setReal(Integer real) {
this.real = real;
}
public Integer getDetected() {
return detected;
}
public void setDetected(Integer detected) {
this.detected = detected;
}
}
\ No newline at end of file
package com.symbol.elearningapp.service;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class ClassDetail {
@SerializedName("id")
@Expose
private String id;
@SerializedName("subject")
@Expose
private String subject;
@SerializedName("date")
@Expose
private String date;
@SerializedName("classTime")
@Expose
private String classTime;
@SerializedName("listStd")
@Expose
private List<StudentDetails> listStd = null;
public ClassDetail(String id, String subject, String date, String classTime, List<StudentDetails> listStd) {
this.id = id;
this.subject = subject;
this.date = date;
this.classTime = classTime;
this.listStd = listStd;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public String getClassTime() {
return classTime;
}
public void setClassTime(String classTime) {
this.classTime = classTime;
}
public List<StudentDetails> getListStd() {
return listStd;
}
public void setListStd(List<StudentDetails> listStd) {
this.listStd = listStd;
}
}
package com.symbol.elearningapp.service;
import android.util.Log;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
import retrofit2.converter.scalars.ScalarsConverterFactory;
public class RetrofitClient {
public static Retrofit getApiClient(String baseUrl){
Gson gson = new GsonBuilder()
.setLenient()
.create();
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(baseUrl)
.addConverterFactory(ScalarsConverterFactory.create())
.addConverterFactory(GsonConverterFactory.create(gson))
.build();
return retrofit;
}
}
package com.symbol.elearningapp.service;
import java.util.List;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Path;
import retrofit2.http.Query;
import retrofit2.http.Url;
public interface ServiceApi {
@POST("/login")
Call<String> login(@Body User body);
@GET("/class")
Call<List<ClassDetail>> classDetails();
@POST("/class")
Call<ClassDetail> addClassDetail(@Body ClassDetail body);
@PUT("/class")
Call<String> updateUser(@Body ClassDetail body);
@DELETE("/class")
Call<String> deleteUser(@Query("id") String id);
@POST("/atd")
Call<AttendanceDetail> addAttendance(@Body AttendanceDetail body);
@GET()
Call<ChartData> getAttendance(@Url String url);
@GET()
Call<List<StudentDetails>> getStudents(@Url String url);
}
package com.symbol.elearningapp.service;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class StudentDetails {
@SerializedName("id")
@Expose
private String id;
@SerializedName("student_name")
@Expose
private String studentName;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getStudentName() {
return studentName;
}
public void setStudentName(String studentName) {
this.studentName = studentName;
}
}
package com.symbol.elearningapp.service;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class User {
private String role;
private String username;
private String password;
public User(String role, String username, String password) {
this.role = role;
this.username = username;
this.password = password;
}
public User(String username, String password) {
this.username = username;
this.password = password;
}
public String getRole() {
return role;
}
public void setRole(String role) {
this.role = role;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:toYDelta="0%p"
android:fromYDelta="100%p"
android:duration="3000"/>
</set>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:duration="2000"
android:fromYDelta="-100%p"
android:fromXDelta="0%p"/>
</set>
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/button_grey"/>
<corners android:radius="10dp"/>
</shape>
\ No newline at end of file
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/white"/>
<corners android:radius="10dp"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/colorPrimaryDark"/>
<corners android:radius="10dp"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<vector
android:height="108dp"
android:width="108dp"
android:viewportHeight="108"
android:viewportWidth="108"
xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z"/>
<path android:fillColor="#00000000" android:pathData="M9,0L9,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,0L19,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M29,0L29,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M39,0L39,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M49,0L49,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M59,0L59,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M69,0L69,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M79,0L79,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M89,0L89,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M99,0L99,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,9L108,9"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,19L108,19"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,29L108,29"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,39L108,39"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,49L108,49"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,59L108,59"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,69L108,69"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,79L108,79"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,89L108,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,99L108,99"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,29L89,29"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,39L89,39"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,49L89,49"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,59L89,59"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,69L89,69"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,79L89,79"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M29,19L29,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M39,19L39,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M49,19L49,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M59,19L59,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M69,19L69,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M79,19L79,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
</vector>
<?xml version="1.0" encoding="utf-8"?>
<vector
android:height="108dp"
android:width="108dp"
android:viewportHeight="108"
android:viewportWidth="108"
xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FAFAFA"
android:pathData="M0,0h108v108h-108z"/>
<path android:fillColor="#00000000" android:pathData="M9,0L9,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,0L19,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M29,0L29,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M39,0L39,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M49,0L49,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M59,0L59,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M69,0L69,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M79,0L79,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M89,0L89,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M99,0L99,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,9L108,9"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,19L108,19"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,29L108,29"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,39L108,39"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,49L108,49"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,59L108,59"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,69L108,69"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,79L108,79"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,89L108,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,99L108,99"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,29L89,29"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,39L89,39"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,49L89,49"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,59L89,59"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,69L89,69"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,79L89,79"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M29,19L29,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M39,19L39,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M49,19L49,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M59,19L59,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M69,19L69,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M79,19L79,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
</vector>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/appbackground"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<Spinner
android:id="@+id/spinner1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:drawable/btn_dropdown"
android:spinnerMode="dropdown"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<TextView
android:id="@+id/tvsubject"
android:layout_width="0dp"
android:layout_weight="3"
android:layout_height="match_parent"
android:gravity="center"
android:textStyle="bold"
android:text="Absent"
android:textSize="@dimen/_15ssp"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2">
<org.eazegraph.lib.charts.PieChart
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/piechart"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="6dp"
android:layout_weight="1"
android:layout_marginTop="15dp"
android:layout_marginLeft="15dp"
android:layout_marginBottom="15dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="horizontal"
android:layout_weight="1">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="horizontal"
android:layout_weight="1">
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:gravity="center"
android:layout_height="match_parent">
<View
android:layout_width="@dimen/_20sdp"
android:layout_height="@dimen/_20sdp"
android:background="@color/button_green"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp" />
</LinearLayout>
<TextView
android:layout_width="0dp"
android:layout_weight="3"
android:layout_height="match_parent"
android:gravity="center"
android:textStyle="bold"
android:text="Present"
android:textSize="@dimen/_12ssp"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="horizontal"
android:layout_weight="1">
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:gravity="center"
android:layout_height="match_parent">
<View
android:layout_width="@dimen/_20sdp"
android:layout_height="@dimen/_20sdp"
android:background="@color/colorAccent"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp" />
</LinearLayout>
<TextView
android:layout_width="0dp"
android:layout_weight="3"
android:layout_height="match_parent"
android:gravity="center"
android:textStyle="bold"
android:text="Absent"
android:textSize="@dimen/_12ssp"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"/>
</LinearLayout>
<LinearLayout
android:layout_marginStart="@dimen/_20sdp"
android:layout_marginEnd="@dimen/_20sdp"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center"
android:layout_weight="1">
<TextView
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="0dp"
android:gravity="center"
android:textStyle="bold"
android:text="Total Sessions"
android:textSize="@dimen/_12ssp"/>
<TextView
android:background="@color/white"
android:id="@+id/tvTotal"
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="0dp"
android:gravity="center"
android:textStyle="bold"
android:text="0"
android:textSize="@dimen/_12ssp"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center"
android:layout_weight="1">
<TextView
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="0dp"
android:gravity="center"
android:textStyle="bold"
android:text="Present"
android:textSize="@dimen/_12ssp"/>
<TextView
android:background="@color/white"
android:id="@+id/tvPresent"
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="0dp"
android:gravity="center"
android:textStyle="bold"
android:text="0"
android:textSize="@dimen/_12ssp"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center"
android:layout_weight="1">
<TextView
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="0dp"
android:gravity="center"
android:textStyle="bold"
android:text="Absent"
android:textSize="@dimen/_12ssp"/>
<TextView
android:background="@color/white"
android:id="@+id/tvAbsent"
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="0dp"
android:gravity="center"
android:textStyle="bold"
android:text="0"
android:textSize="@dimen/_12ssp"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/appbackground"
tools:context=".ClassEditActivity">
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/_30sdp"
android:background="@drawable/white_curved"
android:padding="@dimen/_5sdp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:text="Subject"
android:gravity="center"
android:textSize="@dimen/_14ssp"
android:textStyle="bold" />
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:text="Date"
android:gravity="center"
android:textSize="@dimen/_14ssp"
android:textStyle="bold" />
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:text="Class Time"
android:gravity="center"
android:textSize="@dimen/_14ssp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:orientation="vertical">
<EditText
android:id="@+id/etsubject"
android:layout_width="match_parent"
android:layout_height="0dp"
android:maxLines="1"
android:layout_weight="1"
android:gravity="center_vertical"
android:textSize="@dimen/_14ssp" />
<EditText
android:id="@+id/etdate"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:clickable="false"
android:cursorVisible="false"
android:focusable="false"
android:focusableInTouchMode="false"
android:gravity="center_vertical"
android:textSize="@dimen/_14ssp" />
<EditText
android:id="@+id/etclasstime"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:clickable="false"
android:cursorVisible="false"
android:focusable="false"
android:focusableInTouchMode="false"
android:gravity="center_vertical"
android:textSize="@dimen/_14ssp" />
</LinearLayout>
</LinearLayout>
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_add"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/_50sdp"
android:layout_marginRight="@dimen/_50sdp"
android:stateListAnimator="@null"
android:text="ADD"
android:textAllCaps="false"
android:textColor="@color/white"
app:backgroundTint="@color/colorPrimaryAccentBlue"
app:cornerRadius="7dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/appbackground"
android:orientation="vertical"
tools:context=".ClassDetailActivty">
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_add"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:letterSpacing="0"
android:stateListAnimator="@null"
android:text="ADD"
android:textAllCaps="false"
android:textColor="@color/white"
app:backgroundTint="@color/colorPrimaryAccentBlue"
app:cornerRadius="7dp" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvDetails"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="@dimen/_2sdp"
android:layout_weight="15" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/appbackground"
tools:context=".ClassEditActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
android:layout_margin="@dimen/_30sdp"
android:padding="@dimen/_5sdp"
android:background="@drawable/grey_back_curved"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="0dp"
android:textStyle="bold"
android:text="Subject"
android:gravity="center"
android:textSize="@dimen/_14ssp"/>
<TextView
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="0dp"
android:textStyle="bold"
android:gravity="center"
android:text="Date"
android:textSize="@dimen/_14ssp"/>
<TextView
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="0dp"
android:textStyle="bold"
android:gravity="center"
android:text="Class Time"
android:textSize="@dimen/_14ssp"/>
<TextView
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="0dp"
android:textStyle="bold"
android:gravity="center"
android:text="Students"
android:textSize="@dimen/_14ssp"/>
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_Delete"
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="0dp"
android:letterSpacing="0"
android:stateListAnimator="@null"
android:text="DELETE"
android:textAllCaps="false"
android:textColor="@color/white"
android:textSize="@dimen/_10ssp"
app:backgroundTint="@color/colorAccent"
app:cornerRadius="7dp" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:orientation="vertical">
<EditText
android:id="@+id/etsubject1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:maxLines="1"
android:layout_weight="1"
android:gravity="center_vertical"
android:textSize="@dimen/_14ssp" />
<EditText
android:id="@+id/etdate1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:clickable="false"
android:cursorVisible="false"
android:focusable="false"
android:focusableInTouchMode="false"
android:gravity="center_vertical"
android:textSize="@dimen/_14ssp" />
<EditText
android:id="@+id/etclasstime1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:clickable="false"
android:cursorVisible="false"
android:focusable="false"
android:focusableInTouchMode="false"
android:gravity="center_vertical"
android:textSize="@dimen/_14ssp" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_add"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:letterSpacing="0"
android:stateListAnimator="@null"
android:text="Add Students"
android:textAllCaps="false"
android:textColor="@color/white"
app:backgroundTint="@color/button_green"
app:cornerRadius="7dp" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_edit"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:letterSpacing="0"
android:stateListAnimator="@null"
android:text="EDIT"
android:textAllCaps="false"
android:textColor="@color/white"
app:backgroundTint="@color/colorPrimaryAccentBlue"
app:cornerRadius="7dp" />
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/appbackground"
android:orientation="vertical"
tools:context=".HomeActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="horizontal"
android:layout_weight="2"
android:padding="@dimen/_5sdp">
<LinearLayout
android:id="@+id/llbutton1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/white_curved"
android:orientation="vertical"
android:gravity="center"
android:padding="@dimen/_5sdp"
android:layout_margin="@dimen/_3sdp">
<ImageView
android:id="@+id/ivbutton1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:layout_gravity="center"
android:scaleType="fitCenter"
/>
<com.google.android.material.button.MaterialButton
android:id="@+id/ttbutton1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center"
android:letterSpacing="0"
android:stateListAnimator="@null"
android:text="Login"
android:textAllCaps="false"
android:textColor="@color/white"
app:backgroundTint="@color/colorPrimaryAccentBlue"
app:cornerRadius="7dp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/llbutton2"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/white_curved"
android:orientation="vertical"
android:gravity="center"
android:padding="@dimen/_5sdp"
android:layout_margin="@dimen/_3sdp">
<ImageView
android:id="@+id/ivbutton2"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:layout_gravity="center"
android:scaleType="fitCenter" />
<com.google.android.material.button.MaterialButton
android:id="@+id/ttbutton2"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center"
android:letterSpacing="0"
android:stateListAnimator="@null"
android:text="Login"
android:textAllCaps="false"
android:textColor="@color/white"
app:backgroundTint="@color/colorPrimaryAccentBlue"
app:cornerRadius="7dp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="horizontal"
android:layout_weight="2"
android:padding="@dimen/_5sdp">
<LinearLayout
android:id="@+id/llbutton3"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/white_curved"
android:orientation="vertical"
android:gravity="center"
android:padding="@dimen/_5sdp"
android:layout_margin="@dimen/_3sdp">
<ImageView
android:id="@+id/ivbutton3"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:layout_gravity="center"
android:scaleType="fitCenter" />
<com.google.android.material.button.MaterialButton
android:id="@+id/ttbutton3"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center"
android:letterSpacing="0"
android:stateListAnimator="@null"
android:text="Login"
android:textAllCaps="false"
android:textColor="@color/white"
app:backgroundTint="@color/colorPrimaryAccentBlue"
app:cornerRadius="7dp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/llbutton4"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/white_curved"
android:orientation="vertical"
android:gravity="center"
android:padding="@dimen/_5sdp"
android:layout_margin="@dimen/_3sdp">
<ImageView
android:id="@+id/ivbutton4"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:layout_gravity="center"
android:scaleType="fitCenter"/>
<com.google.android.material.button.MaterialButton
android:id="@+id/ttbutton4"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center"
android:letterSpacing="0"
android:stateListAnimator="@null"
android:text="Login"
android:textAllCaps="false"
android:textColor="@color/white"
app:backgroundTint="@color/colorPrimaryAccentBlue"
app:cornerRadius="7dp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
</LinearLayout>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".TutorJoinActivity">
<androidx.camera.view.PreviewView
android:id="@+id/previewView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment