Commit 9d73c288 authored by Vyshna-Sri's avatar Vyshna-Sri

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	app/build.gradle
parents a87b64e9 a26ec0be
......@@ -16,7 +16,10 @@ android {
install "pillow"
install "opencv-contrib-python-headless"
install "fuzzywuzzy"
install "nltk"
install "pandas"
install "sklearn"
}
}
......@@ -80,6 +83,7 @@ dependencies {
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'
......@@ -92,8 +96,14 @@ 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'
}
\ No newline at end of file
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
......@@ -10,6 +10,8 @@
<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"
......@@ -23,7 +25,8 @@
android:roundIcon="@mipmap/app_logo"
android:supportsRtl="true"
android:theme="@style/Theme.ProbabilityAndStatisticsAnalyserAndEducator">
<activity android:name=".adaptiveLearning.VideoController"></activity>
<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" />
......
......@@ -76,7 +76,6 @@ public class CourseHandler extends AppCompatActivity {
finish();
}
}
}
\ No newline at end of file
......@@ -75,8 +75,6 @@ public class DashBoardHome extends Fragment {
//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) {
......@@ -168,6 +166,7 @@ public class DashBoardHome extends Fragment {
@Override
public void onClick(View view) {
//Create User Progress Tracker
PROGRESS_LEVEL = dbHelper.UserProgressChecker(userID,SELECTED_QUESTION_TYPE);
if (PROGRESS_LEVEL == 0){
Intent intent = new Intent(getContext(),StartingScreen.class);
......
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 {
......@@ -97,4 +104,63 @@ public class DbHelper {
}
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
......@@ -107,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);
......@@ -194,9 +218,9 @@ public class QuizActivity extends AppCompatActivity {
}
});
}
//Display next question
private void showNextQuestion(){
rb_QuizQ1.setTextColor(textColourDefaultRb);
......@@ -238,8 +262,6 @@ public class QuizActivity extends AppCompatActivity {
}
//get current question marks
allocatedMark = currentQuestion.getAllocatedMarks();
......@@ -250,7 +272,6 @@ public class QuizActivity extends AppCompatActivity {
rb_QuizQ4.setText(currentQuestion.getOption4());
questionCounter++;
// show next question to user
textViewQuestionCount.setText("Question: "+ questionCounter+ "/" + questionCountTotal);
......@@ -286,6 +307,7 @@ public class QuizActivity extends AppCompatActivity {
}.start();
}
private void updateCountDownText(){
int minutes = (int) (timeLeftMillis / 1000) / 60;
int seconds = (int) (timeLeftMillis / 1000) % 60;
......@@ -315,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;
......@@ -368,6 +391,7 @@ public class QuizActivity extends AppCompatActivity {
}
}
//before we finished our quiz we send our score in to starting screen
private void finishQuiz(){
......
......@@ -36,7 +36,6 @@ public class StartingScreen extends AppCompatActivity {
DbHelper dbHelper;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
......@@ -78,7 +77,6 @@ public class StartingScreen extends AppCompatActivity {
button_back_quiz.setVisibility(View.INVISIBLE);
button_back_quiz.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
......@@ -97,8 +95,6 @@ public class StartingScreen extends AppCompatActivity {
}
}
});
}
private void Start() {
Intent intent = new Intent(StartingScreen.this, QuizActivity.class);
......@@ -123,10 +119,7 @@ public class StartingScreen extends AppCompatActivity {
if (isInitialExamFinished == 1){
button_back_quiz.setVisibility(View.VISIBLE);
}
}
}
}
......@@ -164,8 +157,6 @@ public class StartingScreen extends AppCompatActivity {
startActivity(intent);
finish();
}
}
public void LoadNextScreen(){
......
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;
}
}
......@@ -2,31 +2,73 @@ package com.elearning.probabilityandstatisticsanalyserandeducator.adaptiveLearni
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;
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) {
......@@ -46,5 +88,38 @@ public class VideoController extends YouTubeBaseActivity {
}
});
// 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
......@@ -14,10 +14,14 @@ 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() {
......@@ -36,13 +40,26 @@ public class DescriptiveCourse extends Fragment {
btn_1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(getContext(), VideoController.class);
// intent.putExtra("Selected_Question_type", SELECT_QUESTION_TYPE);
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;
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
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.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
......@@ -5,6 +5,7 @@
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
......@@ -19,4 +20,17 @@
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
......@@ -4,6 +4,7 @@
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 -->
......@@ -11,88 +12,95 @@
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Wellcome to Descriptive Statics Course"
android:textSize="18sp"
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.581"
app:layout_constraintHorizontal_bias="0.454"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.168" />
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.23"
app:layout_constraintHorizontal_bias="0.205"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.3" />
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="Button 1"
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.378" />
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.189"
app:layout_constraintHorizontal_bias="0.149"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.515" />
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="Button 2"
android:text=" Start "
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.226"
app:layout_constraintHorizontal_bias="0.25"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.605" />
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.265"
app:layout_constraintHorizontal_bias="0.264"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.721" />
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="Button 3"
android:text=" Start "
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.226"
app:layout_constraintHorizontal_bias="0.275"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.801" />
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.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
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