Commit 9c64a8f4 authored by IT17165662's avatar IT17165662

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	app/build.gradle
#	app/src/main/AndroidManifest.xml
parents 2c71ad8a a26ec0be
......@@ -16,6 +16,10 @@ android {
install "pillow"
install "opencv-contrib-python-headless"
install "fuzzywuzzy"
install "pandas"
install "sklearn"
}
}
......@@ -78,6 +82,8 @@ dependencies {
implementation files('libs\\activation.jar')
implementation files('libs\\mail.jar')
implementation files('libs\\additional.jar')
implementation files('libs\\YouTubeAndroidPlayerApi.jar')
implementation files('libs\\picasso-2.5.2.jar')
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
......@@ -90,6 +96,11 @@ dependencies {
implementation 'com.opencsv:opencsv:4.6'
implementation 'com.alimuzaffar.lib:pinentryedittext:1.3.1'
implementation 'androidx.multidex:multidex:2.0.1'
implementation "androidx.cardview:cardview:1.0.0"
implementation group: 'commons-io', name: 'commons-io', version: '2.7'
implementation group: 'org.apache.commons', name: 'commons-text', version: '1.8'
androidTestImplementation 'com.android.support.test:rules:1.0.2'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
......
package com.elearning.probabilityandstatisticsanalyserandeducator;
import android.app.Activity;
import android.app.Instrumentation;
import android.view.View;
import androidx.test.rule.ActivityTestRule;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.action.ViewActions.click;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
import static org.junit.Assert.*;
public class WelcomeTest {
@Rule
public ActivityTestRule<Welcome> mActivityTestRule =
new ActivityTestRule<Welcome>(Welcome.class);
Instrumentation.ActivityMonitor monitor = getInstrumentation().addMonitor(UserDashBoard.class.getName(),null,false);
private Welcome welcome = null;
@Before
public void setUp() throws Exception {
welcome = mActivityTestRule.getActivity();
}
@Test
public void testLaunch(){
View view = welcome.findViewById(R.id.btn_login);
assertNotNull(view);
onView(withId(R.id.btn_login)).perform(click());
Activity testedFunction = getInstrumentation().waitForMonitorWithTimeout(monitor,35000);
assertNotNull(testedFunction);
testedFunction.finish();
}
@After
public void tearDown() throws Exception {
welcome = null;
}
}
\ No newline at end of file
package com.elearning.probabilityandstatisticsanalyserandeducator.adaptiveLearning;
import android.app.Activity;
import android.app.Instrumentation;
import android.view.View;
import androidx.test.rule.ActivityTestRule;
import com.elearning.probabilityandstatisticsanalyserandeducator.R;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.action.ViewActions.click;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
import static org.junit.Assert.*;
public class StartingScreenTest {
@Rule
public ActivityTestRule<StartingScreen> mActivityTestRule =
new ActivityTestRule<StartingScreen>(StartingScreen.class);
Instrumentation.ActivityMonitor monitor = getInstrumentation().addMonitor(QuizActivity.class.getName(),null,false);
private StartingScreen startingScreen = null;
@Before
public void setUp() throws Exception {
startingScreen = mActivityTestRule.getActivity();
}
@Test
public void testLaunch(){
View view = startingScreen.findViewById(R.id.button_start_quiz);
assertNotNull(view);
onView(withId(R.id.button_start_quiz)).perform(click());
Activity testedFunction = getInstrumentation().waitForMonitorWithTimeout(monitor,45000);
assertNotNull(testedFunction);
testedFunction.finish();
}
@After
public void tearDown() throws Exception {
startingScreen = null;
}
}
\ No newline at end of file
......@@ -2,6 +2,21 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.elearning.probabilityandstatisticsanalyserandeducator">
<uses-feature
android:name="android.hardware.camera2"
android:required="true" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission
android:name="android.permission.CAMERA"
android:required="true"
android:requiredFeature="true" />
<application
android:allowBackup="true"
android:icon="@mipmap/app_logo"
......@@ -15,6 +30,10 @@
<activity android:name=".calculationfunction.IndepeEssayTypeProCalc" />
<activity android:name=".calculationfunction.DepEssayTypeProbabilityCalculation" />
<activity android:name=".calculationfunction.ProbablilityCalculation" />
android:theme="@style/Theme.ProbabilityAndStatisticsAnalyserAndEducator">
<activity android:name=".adaptiveLearning.VideoHandler"></activity>
<activity android:name=".adaptiveLearning.VideoController" />
<activity android:name=".adaptiveLearning.CourseHandler" />
<activity android:name=".inputMethod.StandardDeviationInputMethod" />
<activity android:name=".calculationfunction.StandaradDeviationCalculation" />
<activity android:name=".calculationfunction.EssayTypeStdQuestionActivity" />
......@@ -59,17 +78,4 @@
</provider>
</application>
<uses-feature
android:name="android.hardware.camera2"
android:required="true" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission
android:name="android.permission.CAMERA"
android:required="true"
android:requiredFeature="true" />
</manifest>
\ No newline at end of file
......@@ -2,11 +2,13 @@ package com.elearning.probabilityandstatisticsanalyserandeducator;
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.core.view.GravityCompat;
import androidx.drawerlayout.widget.DrawerLayout;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.MenuItem;
......@@ -53,6 +55,8 @@ public class UserDashBoard extends AppCompatActivity implements NavigationView.O
if (isInitialExamFinished == 0){
Intent intent = new Intent(UserDashBoard.this,StartingScreen.class);
// intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
intent.putExtra("isInitialExamFinished",isInitialExamFinished);
startActivity(intent);
}
......@@ -98,6 +102,27 @@ public class UserDashBoard extends AppCompatActivity implements NavigationView.O
if (drawer.isDrawerOpen(GravityCompat.START)){
drawer.closeDrawer(GravityCompat.START);
}
super.onBackPressed();
// super.onBackPressed();
AlertDialog.Builder builder = new AlertDialog.Builder(UserDashBoard.this);
builder.setTitle(R.string.app_name);
//builder.setIcon(R.mipmap.ic_launcher);
builder.setMessage("Do you want to exit?")
.setCancelable(false)
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
Intent intent = new Intent(UserDashBoard.this, Welcome.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
startActivity(intent);
finish();
}
})
.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert = builder.create();
alert.show();
}
}
\ No newline at end of file
......@@ -147,6 +147,7 @@ public class Welcome extends AppCompatActivity {
con.close();
if (is_Active == 1){
Intent intent = new Intent(Welcome.this, UserDashBoard.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
startActivity(intent);
finish();
}else{
......
......@@ -57,7 +57,7 @@ public class AdaptiveQuestionGenarator {
questionList = dbHelper.NormalDistributionGetAllInitialQuestion();
easyQuestionList = dbHelper.NormalDistributionGenarateEasyQuestions();
moderateQuestionList = dbHelper.NormalDistributionGenarateModerateQuestions();
hardQuestionList = dbHelper.Z_ScoreGenarateHardQuestions();
hardQuestionList = dbHelper.NormalDistributionGenarateHardQuestions();
}
......
package com.elearning.probabilityandstatisticsanalyserandeducator.adaptiveLearning;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Button;
import com.elearning.probabilityandstatisticsanalyserandeducator.MainActivity;
import com.elearning.probabilityandstatisticsanalyserandeducator.R;
import com.elearning.probabilityandstatisticsanalyserandeducator.SessionManager;
import com.elearning.probabilityandstatisticsanalyserandeducator.UserDashBoard;
import com.elearning.probabilityandstatisticsanalyserandeducator.adaptiveLearning.courses.DescriptiveCourse;
import com.elearning.probabilityandstatisticsanalyserandeducator.adaptiveLearning.courses.NormalDistributionCourse;
import com.elearning.probabilityandstatisticsanalyserandeducator.adaptiveLearning.courses.ProbabilityCourse;
import com.elearning.probabilityandstatisticsanalyserandeducator.adaptiveLearning.courses.ProbabilityDistrributionCourse;
import com.elearning.probabilityandstatisticsanalyserandeducator.adaptiveLearning.courses.StandardDeviationCourse;
import com.elearning.probabilityandstatisticsanalyserandeducator.adaptiveLearning.courses.Z_ScoreCourse;
import java.util.HashMap;
public class CourseHandler extends AppCompatActivity {
private int userID;
static int SELECT_QUESTION_TYPE = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_course_handler);
//By using session Manager we tacking user details
SessionManager sessionManager = new SessionManager(this);
//------------------------- Creating Hash Map---------------------------------
HashMap<String,String> userDetails = sessionManager.getUserDetailsFromSession();
//tacking userID from session manager and it come as a string
//we convert userID int by using parseInt and asssin it into userID
userID = Integer.parseInt(userDetails.get(SessionManager.KEY_UID));
Intent intent = getIntent();
SELECT_QUESTION_TYPE = intent.getIntExtra("Selected_Question_type",0);
if (SELECT_QUESTION_TYPE == 1){
// call the fragment manager
getSupportFragmentManager().beginTransaction().add(R.id.course_container,new DescriptiveCourse()).commit();
}else if (SELECT_QUESTION_TYPE == 2){
// call the fragment manager
getSupportFragmentManager().beginTransaction().add(R.id.course_container,new StandardDeviationCourse()).commit();
}else if (SELECT_QUESTION_TYPE == 3){
// call the fragment manager
getSupportFragmentManager().beginTransaction().add(R.id.course_container,new ProbabilityCourse()).commit();
}else if (SELECT_QUESTION_TYPE == 4){
// call the fragment manager
getSupportFragmentManager().beginTransaction().add(R.id.course_container,new ProbabilityDistrributionCourse()).commit();
}else if (SELECT_QUESTION_TYPE == 5){
// call the fragment manager
getSupportFragmentManager().beginTransaction().add(R.id.course_container,new Z_ScoreCourse()).commit();
}else if (SELECT_QUESTION_TYPE == 6){
// call the fragment manager
getSupportFragmentManager().beginTransaction().add(R.id.course_container,new NormalDistributionCourse()).commit();
}else {
Intent intent1 = new Intent(this, UserDashBoard.class);
intent1.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
startActivity(intent1);
finish();
}
}
}
\ No newline at end of file
......@@ -17,16 +17,24 @@ import android.widget.Button;
import android.widget.LinearLayout;
import com.elearning.probabilityandstatisticsanalyserandeducator.R;
import com.elearning.probabilityandstatisticsanalyserandeducator.SessionManager;
import com.elearning.probabilityandstatisticsanalyserandeducator.UserDashBoard;
import java.util.HashMap;
import static androidx.appcompat.content.res.AppCompatResources.getDrawable;
public class DashBoardHome extends Fragment {
LinearLayout descriptive_ststis, standard_dev, probability, probability_deistribu, z_score, normal_distribu;
Button dashbord_continur, dashboard_cancel;
Animation fade;
static int userID;
static int SELECTED_QUESTION_TYPE = 0;
static int PROGRESS_LEVEL = 0;
DbHelper dbHelper;
......@@ -54,6 +62,19 @@ public class DashBoardHome extends Fragment {
dashbord_continur.setAlpha(0);
dashboard_cancel.setAlpha(0);
dbHelper = new DbHelper();
//By using session Manager we tacking user details
SessionManager sessionManager = new SessionManager(getContext());
//------------------------- Creating Hash Map---------------------------------
HashMap<String,String> userDetails = sessionManager.getUserDetailsFromSession();
//tacking userID from session manager and it come as a string
//we convert userID int by using parseInt and asssin it into userID
userID = Integer.parseInt(userDetails.get(SessionManager.KEY_UID));
descriptive_ststis.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
......@@ -145,11 +166,25 @@ public class DashBoardHome extends Fragment {
@Override
public void onClick(View view) {
Intent intent = new Intent(getContext(),StartingScreen.class);
intent.putExtra("Selected_Question_type",SELECTED_QUESTION_TYPE);
startActivity(intent);
//Create User Progress Tracker
PROGRESS_LEVEL = dbHelper.UserProgressChecker(userID,SELECTED_QUESTION_TYPE);
if (PROGRESS_LEVEL == 0){
Intent intent = new Intent(getContext(),StartingScreen.class);
intent.putExtra("Selected_Question_type",SELECTED_QUESTION_TYPE);
startActivity(intent);
}else if (PROGRESS_LEVEL == 1){
Intent intent = new Intent(getContext(),CourseHandler.class);
intent.putExtra("Selected_Question_type",SELECTED_QUESTION_TYPE);
startActivity(intent);
}else{
Intent intent = new Intent(getContext(),UserDashBoard.class);
intent.putExtra("Selected_Question_type",SELECTED_QUESTION_TYPE);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
startActivity(intent);
}
}
});
......
package com.elearning.probabilityandstatisticsanalyserandeducator.adaptiveLearning;
import java.sql.Date;
import java.sql.Time;
public class DataSetModels {
int exam_userID;
String firstName;
String exam_name;
int exam_marks;
String exam_category;
Time exam_start_time;
Time exam_finished_time;
String sex;
String profession;
String anyExperience;
String resonToChoose;
public DataSetModels() {
}
public DataSetModels(int exam_userID, String firstName, String exam_name, int exam_marks, String exam_category, Time exam_start_time, Time exam_finished_time, String sex, String profession, String anyExperience, String resonToChoose) {
this.exam_userID = exam_userID;
this.firstName = firstName;
this.exam_name = exam_name;
this.exam_marks = exam_marks;
this.exam_category = exam_category;
this.exam_start_time = exam_start_time;
this.exam_finished_time = exam_finished_time;
this.sex = sex;
this.profession = profession;
this.anyExperience = anyExperience;
this.resonToChoose = resonToChoose;
}
public void setDataSetModels(int exam_userID, String firstName, String exam_name, int exam_marks, String exam_category, Time exam_start_time, Time exam_finished_time, String sex, String profession, String anyExperience, String resonToChoose) {
this.exam_userID = exam_userID;
this.firstName = firstName;
this.exam_name = exam_name;
this.exam_marks = exam_marks;
this.exam_category = exam_category;
this.exam_start_time = exam_start_time;
this.exam_finished_time = exam_finished_time;
this.sex = sex;
this.profession = profession;
this.anyExperience = anyExperience;
this.resonToChoose = resonToChoose;
}
public int getExam_userID() {
return exam_userID;
}
public void setExam_userID(int exam_userID) {
this.exam_userID = exam_userID;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getExam_name() {
return exam_name;
}
public void setExam_name(String exam_name) {
this.exam_name = exam_name;
}
public int getExam_marks() {
return exam_marks;
}
public void setExam_marks(int exam_marks) {
this.exam_marks = exam_marks;
}
public String getExam_category() {
return exam_category;
}
public void setExam_category(String exam_category) {
this.exam_category = exam_category;
}
public Time getExam_start_time() {
return exam_start_time;
}
public void setExam_start_time(Time exam_start_time) {
this.exam_start_time = exam_start_time;
}
public Time getExam_finished_time() {
return exam_finished_time;
}
public void setExam_finished_time(Time exam_finished_time) {
this.exam_finished_time = exam_finished_time;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public String getProfession() {
return profession;
}
public void setProfession(String profession) {
this.profession = profession;
}
public String getAnyExperience() {
return anyExperience;
}
public void setAnyExperience(String anyExperience) {
this.anyExperience = anyExperience;
}
public String getResonToChoose() {
return resonToChoose;
}
public void setResonToChoose(String resonToChoose) {
this.resonToChoose = resonToChoose;
}
@Override
public String toString() {
return "DataSetModels{" +
"exam_userID=" + exam_userID +
", firstName='" + firstName + '\'' +
", exam_name='" + exam_name + '\'' +
", exam_marks=" + exam_marks +
", exam_category='" + exam_category + '\'' +
", exam_start_time='" + exam_start_time + '\'' +
", exam_finished_time='" + exam_finished_time + '\'' +
", sex='" + sex + '\'' +
", profession='" + profession + '\'' +
", anyExperience='" + anyExperience + '\'' +
", resonToChoose='" + resonToChoose + '\'' +
'}';
}
}
package com.elearning.probabilityandstatisticsanalyserandeducator.adaptiveLearning;
import androidx.recyclerview.widget.RecyclerView;
import com.elearning.probabilityandstatisticsanalyserandeducator.DBConnection;
import java.net.SocketTimeoutException;
import java.sql.Connection;
import java.sql.Date;
import java.sql.ResultSet;
import java.sql.SQLOutput;
import java.sql.Statement;
import java.sql.Time;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class DbHelper {
......@@ -12,6 +21,7 @@ public class DbHelper {
Connection con;
public int isInitialExamFinished = 0;
public int progressLevel = 0;
public int isInitialExamFinished(int userID){
......@@ -41,4 +51,116 @@ public class DbHelper {
}
public int saveUserProgress( int userID, int courseID, int progressLevel){
int checkQuery= 0;
//calling get connection into our con variable and passing values to DB
try {
con = dbConnection.getConnection();
if (con==null){
System.out.println("Connection Error");
}else {
String query = "INSERT INTO User_progress_log(userID, courseID, progressLevel)"
+"VALUES('"+userID+"','"+courseID+"','"+progressLevel+"')";
checkQuery = dbConnection.Save(query);
}
}catch (Exception e){
e.printStackTrace();
}
return checkQuery;
}
public int UserProgressChecker(int userID, int courseID){
try {
//Getting DB connection in to con variable
con = dbConnection.getConnection();
//if DB connection false show error message
if (con == null){
System.out.println("Connection Error");
}else {
//When DB connection works
//Execute SELECT query from DB
String query = "Select progressLevel from User_Progress_Log where userID = '"+userID+"' and courseID = '"+courseID+"'";
Statement st = con.createStatement();
ResultSet rst = st.executeQuery(query);
while(rst.next()){
progressLevel = rst.getInt("progressLevel");
}
}
}catch (Exception e){
e.printStackTrace();
}
return progressLevel;
}
public String[] RecommendationDataFeader(){
DataSetModels dataSetModels = new DataSetModels();
DataSetModels[] dsModelsArray;
dsModelsArray = new DataSetModels[100];
String[] checker = new String[250];
int counter = 0;
List list = new ArrayList<>();
try {
//Getting DB connection in to con variable
con = dbConnection.getConnection();
//if DB connection false show error message
if (con == null){
System.out.println("Connection Error");
}else {
//When DB connection works
//Execute SELECT query from DB
String query = "SELECT dbo.User_exam_log.exam_userID, dbo.User_Table.firstName, dbo.User_exam_log.exam_name, dbo.User_exam_log.exam_marks, dbo.User_exam_log.exam_category, dbo.User_exam_log.exam_start_time, dbo.User_exam_log.exam_finished_time, dbo.User_Table.sex, dbo.User_Table.profession, dbo.User_Table.anyExperience, dbo.User_Table.resonToChoose FROM dbo.User_exam_log INNER JOIN dbo.User_Table ON dbo.User_exam_log.exam_userID = dbo.User_Table.userID";
Statement st = con.createStatement();
ResultSet rst = st.executeQuery(query);
while(rst.next()){
//isInitialExamFinished = rst.getInt("is_initial_finished");
/* dsModelsArray[counter] = new DataSetModels(rst.getInt("exam_userID"),rst.getString("firstName"),rst.getString("exam_name"),
rst.getInt("exam_marks"),rst.getString("exam_category"),rst.getTime("exam_start_time"),rst.getTime("exam_finished_time"),
rst.getString("sex"),rst.getString("profession"),rst.getString("anyExperience"),rst.getString("resonToChoose"));*/
dsModelsArray[counter] = new DataSetModels(rst.getInt("exam_userID"),rst.getString("firstName"),rst.getString("exam_name"),
rst.getInt("exam_marks"),rst.getString("exam_category"),rst.getTime("exam_start_time"),rst.getTime("exam_finished_time"),
rst.getString("sex"),rst.getString("profession"),rst.getString("anyExperience"),rst.getString("resonToChoose"));
String readLine = String.valueOf(rst.getInt("exam_userID")) +"\t" + rst.getString("firstName") +"\t" + rst.getString("exam_name") +"\t" + rst.getInt("exam_marks") +"\t" +
rst.getString("exam_category") +"\t" + rst.getTime("exam_start_time") +"\t" + rst.getTime("exam_finished_time") +"\t" + rst.getString("sex") +"\t" +
rst.getString("profession") +"\t" + rst.getString("anyExperience") +"\t" + rst.getString("resonToChoose") +"\t" + "_" ;
checker[counter] = readLine;
// System.out.println("readLine :" +readLine);
counter ++;
}
//System.out.println("Array :" +Arrays.toString(checker));
}
}catch (Exception e){
e.printStackTrace();
}
return checker;
}
}
......@@ -53,8 +53,8 @@ public class QuizActivity extends AppCompatActivity {
private static final String KEY_MILLIS_LEFT = "keyMillisLeft";
private static final String KEY_ANSWERED ="keyAnswered";
private static final String KEY_QUESTION_LIST = "KeyQuestionList";
private static final String KEY_EXAM_CATEGORY = "InitialExam";
private static final String KEY_EXAM_NAME = "Initial Examination";
private static String KEY_EXAM_CATEGORY = "InitialExam";
private static String KEY_EXAM_NAME = "Initial Examination";
private static final long COUNTDOWN_IN_MILLIS = 30000;
// variable declaration for text view
......@@ -90,6 +90,7 @@ public class QuizActivity extends AppCompatActivity {
private long aveAnsewerdTime = 0;
private long totalExamTime = 0;
private DbHelper dbHelper;
@Override
......@@ -106,7 +107,31 @@ public class QuizActivity extends AppCompatActivity {
userID = Integer.parseInt(userDetails.get(SessionManager.KEY_UID));
System.out.println("user name in ques "+userID);
//setting the question name and exam category
if (SELECT_QUESTION_TYPE == 0){
KEY_EXAM_NAME = "Initial Exam";
KEY_EXAM_CATEGORY = "General Maths Test";
}else if (SELECT_QUESTION_TYPE == 1){
KEY_EXAM_NAME = "Descriptive Statistics Exam";
KEY_EXAM_CATEGORY = "Descriptive Statistics";
}else if (SELECT_QUESTION_TYPE == 2){
KEY_EXAM_NAME = "Standard Deviation Exam";
KEY_EXAM_CATEGORY = "Standard Deviation";
}else if (SELECT_QUESTION_TYPE == 3){
KEY_EXAM_NAME = "Probability Exam";
KEY_EXAM_CATEGORY = "Probability";
}else if (SELECT_QUESTION_TYPE == 4){
KEY_EXAM_NAME = "Probability Distribution Exam";
KEY_EXAM_CATEGORY = "Probability Distribution";
}else if (SELECT_QUESTION_TYPE == 5){
KEY_EXAM_NAME = "Z score Exam";
KEY_EXAM_CATEGORY = "Z score";
}else {
KEY_EXAM_NAME = "Invalid Input";
KEY_EXAM_CATEGORY = "Invalid Input";
}
// assigning textView ID
textViewQuestion = findViewById(R.id.text_view_question);
......@@ -125,6 +150,10 @@ public class QuizActivity extends AppCompatActivity {
textColourDefaultRb = rb_QuizQ1.getTextColors();
textcolorDefaultCD = textViewCountDown.getTextColors();
//DBHelper object
dbHelper = new DbHelper();
//creating adaptive question genarator
adaptiveQuestionGenarator = new AdaptiveQuestionGenarator();
......@@ -144,7 +173,7 @@ public class QuizActivity extends AppCompatActivity {
SimpleDateFormat df = new SimpleDateFormat("HH:mm:ss");
strtingTime = df.format(c.getTime());
//format date as our patten
SimpleDateFormat date = new SimpleDateFormat("YYYY-MM-DD");
SimpleDateFormat date = new SimpleDateFormat("YYYY-MM-dd");
examDate = date.format(c.getTime());
System.out.println("Date "+examDate);
......@@ -189,9 +218,9 @@ public class QuizActivity extends AppCompatActivity {
}
});
}
//Display next question
private void showNextQuestion(){
rb_QuizQ1.setTextColor(textColourDefaultRb);
......@@ -233,8 +262,6 @@ public class QuizActivity extends AppCompatActivity {
}
//get current question marks
allocatedMark = currentQuestion.getAllocatedMarks();
......@@ -245,8 +272,8 @@ public class QuizActivity extends AppCompatActivity {
rb_QuizQ4.setText(currentQuestion.getOption4());
questionCounter++;
// show next question to user
textViewQuestionCount.setText("Question: "+ questionCounter+ "/" + questionCountTotal);
answered = false;
btn_confirm_next.setText("Confirm");
......@@ -280,6 +307,7 @@ public class QuizActivity extends AppCompatActivity {
}.start();
}
private void updateCountDownText(){
int minutes = (int) (timeLeftMillis / 1000) / 60;
int seconds = (int) (timeLeftMillis / 1000) % 60;
......@@ -309,6 +337,7 @@ public class QuizActivity extends AppCompatActivity {
e.printStackTrace();
}
if (answerNr.equals(currentQuestion.getCorrectAns())){
//if the answer is correct isAnswerCorrect will be true
isAnswerCorrect = true;
......@@ -362,6 +391,7 @@ public class QuizActivity extends AppCompatActivity {
}
}
//before we finished our quiz we send our score in to starting screen
private void finishQuiz(){
......@@ -398,7 +428,9 @@ public class QuizActivity extends AppCompatActivity {
checkValue = quizDbHelper.createUser_ExamLog(KEY_EXAM_NAME,userID,examStartedTime,examFinishedTime,dateOfExam,score,numCorrectAns,numWrongAns,aveAnsTime,KEY_EXAM_CATEGORY);
quizDbHelper.UpdateIsInitialExam(userID);
if(SELECT_QUESTION_TYPE != 0){
dbHelper.saveUserProgress(userID, SELECT_QUESTION_TYPE,1);
}
}
......
......@@ -820,7 +820,7 @@ public class QuizDbHelper {
if (con == null){
System.out.println("Connection Error");
}else {
String query = "select * from ques_probability_distribution where dis_difficulty_index BETWEEN 0.3 AND 0.7;";
String query = "select * from ques_probability_distribution where dis_difficulty_index BETWEEN 0.3 AND 0.7";
Statement st = con.createStatement();
ResultSet rst = st.executeQuery(query);
......@@ -1188,7 +1188,7 @@ public class QuizDbHelper {
if (con == null){
System.out.println("Connection Error");
}else {
String query = "select * from ques_initial_Exam where ini_difficulty_index < 0.3";
String query = "select * from ques_normal_distribution where nor_difficulty_index < 0.3";
Statement st = con.createStatement();
ResultSet rst = st.executeQuery(query);
......@@ -1215,7 +1215,7 @@ public class QuizDbHelper {
e.printStackTrace();
}
// System.out.println("dbhelper "+questionList);
System.out.println("NormalDistributionHarddbhelper "+questionList);
return questionList;
}
}
......
......@@ -5,11 +5,19 @@ import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import com.elearning.probabilityandstatisticsanalyserandeducator.MainActivity;
import com.elearning.probabilityandstatisticsanalyserandeducator.R;
import com.elearning.probabilityandstatisticsanalyserandeducator.SessionManager;
import com.elearning.probabilityandstatisticsanalyserandeducator.SignUp;
import com.elearning.probabilityandstatisticsanalyserandeducator.UserDashBoard;
import com.elearning.probabilityandstatisticsanalyserandeducator.Welcome;
import java.util.HashMap;
public class StartingScreen extends AppCompatActivity {
private static final int REQUEST_CODE_QUIZ = 1;
......@@ -19,18 +27,39 @@ public class StartingScreen extends AppCompatActivity {
private TextView textViewHighscore;
Button button_back_quiz;
private int userID;
private int highscore;
static int SELECT_QUESTION_TYPE = 0;
static int isInitialExamFinished = 0;
DbHelper dbHelper;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_starting_screen);
//By using session Manager we tacking user details
SessionManager sessionManager = new SessionManager(this);
//------------------------- Creating Hash Map---------------------------------
HashMap<String,String> userDetails = sessionManager.getUserDetailsFromSession();
//tacking userID from session manager and it come as a string
//we convert userID int by using parseInt and asssin it into userID
userID = Integer.parseInt(userDetails.get(SessionManager.KEY_UID));
Intent intent = getIntent();
SELECT_QUESTION_TYPE = intent.getIntExtra("Selected_Question_type",0);
SELECT_QUESTION_TYPE = intent.getIntExtra("Selected_Question_type",0);
System.out.println("Selected_Question_type "+SELECT_QUESTION_TYPE);
dbHelper = new DbHelper();
isInitialExamFinished = dbHelper.isInitialExamFinished(userID);
//assign text view
//we load the highscor from shared Prefrenc and set it value to textView
textViewHighscore = findViewById(R.id.text_view_highscore);
......@@ -43,11 +72,36 @@ public class StartingScreen extends AppCompatActivity {
Start();
}
});
button_back_quiz = findViewById(R.id.button_back_quiz);
button_back_quiz.setVisibility(View.INVISIBLE);
button_back_quiz.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (SELECT_QUESTION_TYPE != 0) {
Intent intent = new Intent(StartingScreen.this, CourseHandler.class);
intent.putExtra("Selected_Question_type", SELECT_QUESTION_TYPE);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
startActivity(intent);
// finish();
} else {
Intent intent = new Intent(StartingScreen.this, UserDashBoard.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
startActivity(intent);
finish();
}
}
});
}
private void Start() {
Intent intent = new Intent(StartingScreen.this, QuizActivity.class);
intent.putExtra("Selected_Question_type",SELECT_QUESTION_TYPE);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
startActivityForResult(intent, REQUEST_CODE_QUIZ);
}
......@@ -59,9 +113,13 @@ public class StartingScreen extends AppCompatActivity {
int score = data.getIntExtra(QuizActivity.EXTRA_SCORE, 0);
if (score > highscore){
updateHighscore(score);
//finish();
}
isInitialExamFinished = dbHelper.isInitialExamFinished(userID);
if (isInitialExamFinished == 1){
button_back_quiz.setVisibility(View.VISIBLE);
}
}
}
}
......@@ -83,6 +141,37 @@ public class StartingScreen extends AppCompatActivity {
}
@Override
public void onBackPressed() {
super.onBackPressed();
isInitialExamFinished = dbHelper.isInitialExamFinished(userID);
if (isInitialExamFinished == 0){
Intent intent = new Intent(this, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
startActivity(intent);
finish();
}else {
Intent intent = new Intent(this, UserDashBoard.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
startActivity(intent);
finish();
}
}
public void LoadNextScreen(){
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
if (SELECT_QUESTION_TYPE != 0){
Intent intent = new Intent(StartingScreen.this, CourseHandler.class);
intent.putExtra("Selected_Question_type",SELECT_QUESTION_TYPE);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
startActivity(intent);
// finish();
}
}
},5000);
}
}
\ No newline at end of file
package com.elearning.probabilityandstatisticsanalyserandeducator.adaptiveLearning;
import com.elearning.probabilityandstatisticsanalyserandeducator.recycleViewClass.StaticRvAdapter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class SupportRecommendations {
public List recommendedList;
public List nonDublicateList;
int counter = 0;
public List<String> FilterRecommendations(String str, List<String> recommended){
recommendedList = new ArrayList();
nonDublicateList = new ArrayList();
//traverse though the recommended Array
for(Object e: recommended){
if(!nonDublicateList.contains(e)){
nonDublicateList.add(e);
}
}
return nonDublicateList;
}
}
package com.elearning.probabilityandstatisticsanalyserandeducator.adaptiveLearning;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import com.chaquo.python.PyObject;
import com.chaquo.python.Python;
import com.chaquo.python.android.AndroidPlatform;
import com.elearning.probabilityandstatisticsanalyserandeducator.R;
import com.google.android.youtube.player.YouTubeBaseActivity;
import com.google.android.youtube.player.YouTubeInitializationResult;
import com.google.android.youtube.player.YouTubePlayer;
import com.google.android.youtube.player.YouTubePlayerView;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.mail.Message;
public class VideoController extends YouTubeBaseActivity {
Button btn_play, btn_Submit;
YouTubePlayerView youTubePlayerView;
YouTubePlayer.OnInitializedListener onInitializedListener;
TextView textView;
DbHelper dbHelper;
Object[] dataArray;
String[] getInfo;
SupportRecommendations supportRecommendations;
List list;
List recommendations;
List recommendedList;
List ListChecker;
DataSetModels[] dsModelsArray;
String pythonClassName;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_video_player);
Intent intent = getIntent();
String Category = intent.getStringExtra("Selected_Sub_Category");
System.out.println("Sub_Category :"+Category);
list = new ArrayList<>();
recommendations = new ArrayList();
recommendedList = new ArrayList();
ListChecker = new ArrayList();
btn_play = findViewById(R.id.btn_play);
btn_Submit = findViewById(R.id.btnSubmit);
textView = findViewById(R.id.vID1);
supportRecommendations = new SupportRecommendations();
youTubePlayerView = findViewById(R.id.YoutubePlayerView);
//select the python class according to selected video category
if(Category.equals("DIS_CAT1")){
pythonClassName = "recommendations";
}else if(Category.equals("DIS_CAT2")){
pythonClassName = "recommendationsCat2";
}
onInitializedListener = new YouTubePlayer.OnInitializedListener() {
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer youTubePlayer, boolean b) {
youTubePlayer.loadVideo("A1mQ9kD-i9I");
}
@Override
public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult youTubeInitializationResult) {
}
};
btn_play.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
youTubePlayerView.initialize("AIzaSyD5G-0hTA2rb3hMSQX7oiiUK6gI3VSkKd8",onInitializedListener);
}
});
// converting list into array
dataArray = new Object[list.size()];
dataArray = list.toArray(dataArray);
//start python if it is not started
if (!Python.isStarted()){
Python.start(new AndroidPlatform(this));
}
//create python instance
final Python py = Python.getInstance();
btn_Submit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//create python object to load script
int mark = 66;
//calling python class
PyObject pyO = py.getModule(pythonClassName);
//calling python class main function
PyObject obj = pyO.callAttr("main",mark);
//story in the return value in the phython class in to string veriable
String str = obj.toString();
ListChecker = obj.asList();
recommendedList = supportRecommendations.FilterRecommendations(str,ListChecker);
System.out.println("Recommended List "+recommendedList);
// textView.setText(str);
}
});
}
}
\ No newline at end of file
package com.elearning.probabilityandstatisticsanalyserandeducator.adaptiveLearning;
import androidx.appcompat.app.AppCompatActivity;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import com.chaquo.python.PyObject;
import com.chaquo.python.Python;
import com.chaquo.python.android.AndroidPlatform;
import com.elearning.probabilityandstatisticsanalyserandeducator.R;
import com.squareup.picasso.Picasso;
import org.apache.commons.io.IOUtils;
import org.json.JSONObject;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
public class VideoHandler extends AppCompatActivity {
// variable decleration
String pythonClassName;
List recommendedList;
List ListChecker;
SupportRecommendations supportRecommendations;
ImageView imageView;
TextView title;
String VideoId;
@SuppressLint("WrongViewCast")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_video_handler);
//assingned ID
title = findViewById(R.id.video_title);
recommendedList = new ArrayList();
ListChecker = new ArrayList();
imageView = findViewById(R.id.video_ID1);
supportRecommendations = new SupportRecommendations();
Intent intent = getIntent();
String Category = intent.getStringExtra("Selected_Sub_Category");
System.out.println("Sub_Category :"+Category);
try {
VideoId = "k3aKKasOmIw";
String imag_URL = "http://img.youtube.com/vi/"+VideoId+"/0.jpg"; // this is link which will give u thumnail image of that video
Picasso.with(VideoHandler.this).load(imag_URL).placeholder(R.drawable.ic_location).into(imageView);
}catch (Exception e){
e.printStackTrace();
}
//select the python class according to selected video category
if(Category.equals("DIS_CAT1")){
pythonClassName = "recommendations";
}else if(Category.equals("DIS_CAT2")){
pythonClassName = "recommendationsCat2";
}
//start python if it is not started
if (!Python.isStarted()){
Python.start(new AndroidPlatform(this));
}
//create python instance
final Python py = Python.getInstance();
int mark = 66;
//calling python class
PyObject pyO = py.getModule(pythonClassName);
//calling python class main function
PyObject obj = pyO.callAttr("main",mark);
//story in the return value in the phython class in to string veriable
String str = obj.toString();
ListChecker = obj.asList();
recommendedList = supportRecommendations.FilterRecommendations(str,ListChecker);
System.out.println("Recommended List "+recommendedList);
String title = getTitleQuietly("http://www.youtube.com/watch?v=k3aKKasOmIw");
System.out.println("Video Title :"+title);
}
public static String getTitleQuietly(String youtubeUrl) {
System.out.println("test 0");
try {
System.out.println("test 1");
if (youtubeUrl != null) {
System.out.println("test 2");
URL embededURL = new URL("http://www.youtube.com/oembed?url=" +
youtubeUrl + "&format=json"
);
System.out.println("test 3");
String test = new JSONObject(IOUtils.toString(embededURL,"UTF-8")).getString("title");
System.out.println("testt"+ test);
return new JSONObject(IOUtils.toString(embededURL,"UTF-8")).getString("title");
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}
\ No newline at end of file
package com.elearning.probabilityandstatisticsanalyserandeducator.adaptiveLearning.courses;
import android.content.Intent;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import com.elearning.probabilityandstatisticsanalyserandeducator.R;
import com.elearning.probabilityandstatisticsanalyserandeducator.adaptiveLearning.CourseHandler;
import com.elearning.probabilityandstatisticsanalyserandeducator.adaptiveLearning.StartingScreen;
import com.elearning.probabilityandstatisticsanalyserandeducator.adaptiveLearning.VideoController;
import com.elearning.probabilityandstatisticsanalyserandeducator.adaptiveLearning.VideoHandler;
public class DescriptiveCourse extends Fragment {
Button btn_1, btn_2, btn_3;
public static final String cat1 = "DIS_CAT1";
public static final String cat2 = "DIS_CAT2";
public static final String cat3 = "DIS_CAT3";
public DescriptiveCourse() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_descriptive_course, container, false);
btn_1 = view.findViewById(R.id.DecriptiveCourse_btn_1);
btn_2 = view.findViewById(R.id.DecriptiveCourse_btn_2);
btn_3 = view.findViewById(R.id.DecriptiveCourse_btn_3);
btn_1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(getContext(), VideoHandler.class);
intent.putExtra("Selected_Sub_Category", cat1);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
startActivity(intent);
}
});
btn_2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(getContext(), VideoHandler.class);
intent.putExtra("Selected_Sub_Category", cat2);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
startActivity(intent);
}
});
return view;
}
}
\ No newline at end of file
package com.elearning.probabilityandstatisticsanalyserandeducator.adaptiveLearning.courses;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.elearning.probabilityandstatisticsanalyserandeducator.R;
/**
* A simple {@link Fragment} subclass.
* Use the {@link NormalDistributionCourse#newInstance} factory method to
* create an instance of this fragment.
*/
public class NormalDistributionCourse extends Fragment {
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;
public NormalDistributionCourse() {
// Required empty public constructor
}
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment NormalDistributionCourse.
*/
// TODO: Rename and change types and number of parameters
public static NormalDistributionCourse newInstance(String param1, String param2) {
NormalDistributionCourse fragment = new NormalDistributionCourse();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_normal_distribution_course, container, false);
}
}
\ No newline at end of file
package com.elearning.probabilityandstatisticsanalyserandeducator.adaptiveLearning.courses;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.elearning.probabilityandstatisticsanalyserandeducator.R;
/**
* A simple {@link Fragment} subclass.
* Use the {@link ProbabilityCourse#newInstance} factory method to
* create an instance of this fragment.
*/
public class ProbabilityCourse extends Fragment {
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;
public ProbabilityCourse() {
// Required empty public constructor
}
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment ProbabilityCourse.
*/
// TODO: Rename and change types and number of parameters
public static ProbabilityCourse newInstance(String param1, String param2) {
ProbabilityCourse fragment = new ProbabilityCourse();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_probability_course, container, false);
}
}
\ No newline at end of file
package com.elearning.probabilityandstatisticsanalyserandeducator.adaptiveLearning.courses;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.elearning.probabilityandstatisticsanalyserandeducator.R;
/**
* A simple {@link Fragment} subclass.
* Use the {@link ProbabilityDistrributionCourse#newInstance} factory method to
* create an instance of this fragment.
*/
public class ProbabilityDistrributionCourse extends Fragment {
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;
public ProbabilityDistrributionCourse() {
// Required empty public constructor
}
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment ProbabilityDistrributionCourse.
*/
// TODO: Rename and change types and number of parameters
public static ProbabilityDistrributionCourse newInstance(String param1, String param2) {
ProbabilityDistrributionCourse fragment = new ProbabilityDistrributionCourse();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_probability_distrribution_course, container, false);
}
}
\ No newline at end of file
package com.elearning.probabilityandstatisticsanalyserandeducator.adaptiveLearning.courses;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.elearning.probabilityandstatisticsanalyserandeducator.R;
/**
* A simple {@link Fragment} subclass.
* Use the {@link StandardDeviationCourse#newInstance} factory method to
* create an instance of this fragment.
*/
public class StandardDeviationCourse extends Fragment {
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;
public StandardDeviationCourse() {
// Required empty public constructor
}
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment StandardDeviation.
*/
// TODO: Rename and change types and number of parameters
public static StandardDeviationCourse newInstance(String param1, String param2) {
StandardDeviationCourse fragment = new StandardDeviationCourse();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_standard_deviation, container, false);
}
}
\ No newline at end of file
package com.elearning.probabilityandstatisticsanalyserandeducator.adaptiveLearning.courses;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.elearning.probabilityandstatisticsanalyserandeducator.R;
public class VideoList extends Fragment {
public VideoList() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_video_list, container, false);
}
}
\ No newline at end of file
package com.elearning.probabilityandstatisticsanalyserandeducator.adaptiveLearning.courses;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.elearning.probabilityandstatisticsanalyserandeducator.R;
/**
* A simple {@link Fragment} subclass.
* Use the {@link Z_ScoreCourse#newInstance} factory method to
* create an instance of this fragment.
*/
public class Z_ScoreCourse extends Fragment {
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;
public Z_ScoreCourse() {
// Required empty public constructor
}
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment Z_ScoreCourse.
*/
// TODO: Rename and change types and number of parameters
public static Z_ScoreCourse newInstance(String param1, String param2) {
Z_ScoreCourse fragment = new Z_ScoreCourse();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_z__score_course, container, false);
}
}
\ No newline at end of file
......@@ -60,7 +60,7 @@ public class verification_screen extends AppCompatActivity {
final Random myRandom = new Random();
OTP = myRandom.nextInt(10000);
System.out.println("OTP"+OTP);
System.out.println("OTP"+OTP);
//Add OTP number into Session manger
SessionManager sessionManager = new SessionManager(this);
......
import pandas as pd
import numpy as np
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.metrics.pairwise import cosine_similarity
def main():
print("Success")
\ No newline at end of file
from os.path import dirname, join
from com.chaquo.python import Python
import csv
import numpy as np
def main(dataset,a):
user = []
header = ['id', 'name', 'address', 'age']
data = dataset
#my_array = np.array(list(dataset));
#data = ['Afghanistan', 652090, 'AF', 'AFG']
#give directory path
files_dir = str(Python.getPlatform().getApplication().getFilesDir())
filename = join(dirname(files_dir),"test.csv")
with open(filename,'w',encoding = 'utf8', errors ="ignore") as fin:
writer = csv.writer(fin, lineterminator='\n')
writer.writerow(header)
for i in data:
print(i)
if i != "_":
user.append(i)
#print(user)
else:
continue
#print("after ",user)
writer.writerow(user)
#print(i)
#writer.writerow(data)
#writer.writerow(data)
fin.close()
with open(filename,'r',encoding = 'utf8', errors ="ignore") as fin:
data = fin.read()
return ""+data
\ No newline at end of file
import pandas as pd
import numpy as np
import csv
from os.path import dirname, join
from com.chaquo.python import Python
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.metrics.pairwise import cosine_similarity
#defining the function to concatanate selected parameters for the recommendations
def combine_features(row):
return str(row['time_taken'])+" "+row['any_expireance']
#functions to return perticular value when index is pass as the parameter
def find_marks_from_index(index,df):
return df[df.index == index]["marks"].values[0]
def find_index_from_marks(marks,df):
return df[df.marks == marks]["index"].values[0]
def find_link_from_index(index,df):
return df[df.index == index]["link"].values[0]
#defining the main function to recesive marks as the parameter
def main(marks):
#creating array to store reccomendations
matchedkeywordlist=[]
#defining path for dataset file
files_dir = str(Python.getPlatform().getApplication().getFilesDir())
filename = join(dirname(files_dir),"des_cat1.csv")
#reading the csv file
df = pd.read_csv(filename)
#defining the parameters to be considered for the recommendations
features = ['time_taken','any_expireance']
#creating a new row in the dataset by combining time_taken and any_expireance
for feature in features:
df[feature] = df[feature].fillna('')
df["combined_features"] = df.apply(combine_features,axis=1)
#transform the given text in to a vector on the basis of count of each word that occures in the entire dataset
cv = CountVectorizer()
count_matrix = cv.fit_transform(df["combined_features"])
#measure the similearty of the combine_features irrespective of there sizes considering the cosine of the angle between two vectors
cosine_sim = cosine_similarity(count_matrix)
#get the index value of the marks of user
marks_index = find_index_from_marks(marks,df)
#get the similler marks records
similar_marks = list(enumerate(cosine_sim[marks_index]))
#sorting the similer marks
sorted_similar_marks = sorted(similar_marks,key=lambda x:x[1],reverse=True)[1:]
#gettting the most relevant reccomendations
i=0
for element in sorted_similar_marks:
matchedkeywordlist.append(find_link_from_index(element[0],df))
print(find_link_from_index(element[0],df))
i=i+1
if i>10:
break
return matchedkeywordlist
\ No newline at end of file
import pandas as pd
import numpy as np
import csv
from os.path import dirname, join
from com.chaquo.python import Python
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.metrics.pairwise import cosine_similarity
#defining the function to concatanate selected parameters for the recommendations
def combine_features(row):
return str(row['time_taken'])+" "+row['any_expireance']
#functions to return perticular value when index is pass as the parameter
def find_marks_from_index(index,df):
return df[df.index == index]["marks"].values[0]
def find_index_from_marks(marks,df):
return df[df.marks == marks]["index"].values[0]
def find_link_from_index(index,df):
return df[df.index == index]["link"].values[0]
#defining the main function to recesive marks as the parameter
def main(marks):
#creating array to store reccomendations
matchedkeywordlist=[]
#defining path for dataset file
files_dir = str(Python.getPlatform().getApplication().getFilesDir())
filename = join(dirname(files_dir),"des_cat2.csv")
#reading the csv file
df = pd.read_csv(filename)
#defining the parameters to be considered for the recommendations
features = ['time_taken','any_expireance']
#creating a new row in the dataset by combining time_taken and any_expireance
for feature in features:
df[feature] = df[feature].fillna('')
df["combined_features"] = df.apply(combine_features,axis=1)
#transform the given text in to a vector on the basis of count of each word that occures in the entire dataset
cv = CountVectorizer()
count_matrix = cv.fit_transform(df["combined_features"])
#measure the similearty of the combine_features irrespective of there sizes considering the cosine of the angle between two vectors
cosine_sim = cosine_similarity(count_matrix)
#get the index value of the marks of user
marks_index = find_index_from_marks(marks,df)
#get the similler marks records
similar_marks = list(enumerate(cosine_sim[marks_index]))
#sorting the similer marks
sorted_similar_marks = sorted(similar_marks,key=lambda x:x[1],reverse=True)[1:]
#gettting the most relevant reccomendations
i=0
for element in sorted_similar_marks:
matchedkeywordlist.append(find_link_from_index(element[0],df))
print(find_link_from_index(element[0],df))
i=i+1
if i>10:
break
return matchedkeywordlist
\ No newline at end of file
from os.path import dirname, join
from com.chaquo.python import Python
import csv
import numpy as np
def main(dataset,a):
user = []
header = ['id', 'name', 'address', 'age']
data = dataset
#my_array = np.array(list(dataset));
#data = ['Afghanistan', 652090, 'AF', 'AFG']
#give directory path
files_dir = str(Python.getPlatform().getApplication().getFilesDir())
filename = join(dirname(files_dir),"test.csv")
with open(filename,'r',encoding = 'utf8', errors ="ignore") as fin:
data = fin.read()
return ""+data
\ 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"
tools:context=".adaptiveLearning.CourseHandler">
<FrameLayout
android:id="@+id/course_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -183,7 +183,7 @@
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="5dp"
android:text="Settings"
android:text="Log Out"
android:textColor="#ff0000"
android:textSize="18sp" />
......
......@@ -38,5 +38,20 @@
android:background="@color/app_logo_background"
android:text="Start" />
<Button
android:id="@+id/button_back_quiz"
android:layout_width="wrap_content"
android:layout_height="51dp"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="149dp"
android:layout_marginTop="398dp"
android:layout_marginEnd="144dp"
android:layout_marginBottom="194dp"
android:background="@color/app_logo_background"
android:text="Back" />
</RelativeLayout>
\ 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"
tools:context=".adaptiveLearning.VideoHandler">
<ImageView
android:id="@+id/video_ID1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.124"
tools:srcCompat="@tools:sample/avatars" />
<TextView
android:id="@+id/video_title"
android:layout_width="209dp"
android:layout_height="38dp"
android:text="TextView"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</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:orientation="vertical"
android:background="@color/colorAccent"
tools:context=".adaptiveLearning.VideoController">
<com.google.android.youtube.player.YouTubePlayerView
android:id="@+id/YoutubePlayerView"
android:layout_width="match_parent"
android:layout_height="250dp"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Play"
android:id="@+id/btn_play"
android:layout_marginTop="20dp"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/vID1"
/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/btnSubmit"
android:text="Submit"
/>
</LinearLayout>
\ No newline at end of file
......@@ -155,24 +155,25 @@
</TextView>
</LinearLayout>
<Button
android:id="@+id/dashbord_continur"
android:layout_marginTop="20dp"
android:background="@drawable/btn_continue"
android:layout_width="match_parent"
android:layout_height="65dp"
android:layout_marginRight="18dp"
android:layout_marginLeft="18dp">
<Button
android:id="@+id/dashbord_continur"
android:layout_width="match_parent"
android:layout_height="65dp"
android:layout_marginLeft="18dp"
android:layout_marginTop="20dp"
android:layout_marginRight="18dp"
android:text="Continue">
</Button>
</Button>
<Button
android:id="@+id/dashboard_cancel"
android:text="Cancel"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="65dp"
android:layout_marginRight="18dp"
android:layout_marginLeft="18dp"
android:background="@drawable/cancel_btn">
android:layout_marginLeft="18dp">
</Button>
</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="?attr/colorButtonNormal"
tools:context=".adaptiveLearning.courses.DescriptiveCourse">
<!-- TODO: Update blank fragment layout -->
<TextView
android:id="@+id/textView1"
android:layout_width="408dp"
android:layout_height="80dp"
android:text=" Wellcome to Descriptive Statics Course"
android:textColor="@color/black"
android:textSize="20dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.454"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.128" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" Mean, Median, Mode and Range"
android:textColor="@color/teal_700"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.205"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.294" />
<Button
android:id="@+id/DecriptiveCourse_btn_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" Start "
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.226"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.36" />
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" Minimum and Maximum "
android:textColor="@color/teal_700"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.149"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.478" />
<Button
android:id="@+id/DecriptiveCourse_btn_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" Start "
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.25"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.566" />
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" First Quartile, Third Quartile and IQR "
android:textColor="@color/teal_700"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.264"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.689" />
<Button
android:id="@+id/DecriptiveCourse_btn_3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" Start "
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.275"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.767" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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"
tools:context=".adaptiveLearning.courses.NormalDistributionCourse">
<!-- TODO: Update blank fragment layout -->
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Normal Distribution" />
</FrameLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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"
tools:context=".adaptiveLearning.courses.ProbabilityCourse">
<!-- TODO: Update blank fragment layout -->
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Probability" />
</FrameLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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"
tools:context=".adaptiveLearning.courses.ProbabilityDistrributionCourse">
<!-- TODO: Update blank fragment layout -->
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Probability Distribution" />
</FrameLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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"
tools:context=".adaptiveLearning.courses.StandardDeviationCourse">
<!-- TODO: Update blank fragment layout -->
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Standerd Deviation" />
</FrameLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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"
tools:context=".adaptiveLearning.courses.VideoList">
<!-- TODO: Update blank fragment layout -->
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/hello_blank_fragment" />
</FrameLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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"
tools:context=".adaptiveLearning.courses.Z_ScoreCourse">
<!-- TODO: Update blank fragment layout -->
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Z Score" />
</FrameLayout>
\ No newline at end of file
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