Commit 1f48b35d authored by Sven Eric Panitz's avatar Sven Eric Panitz
Browse files

Syntax Editar for Java.

parent 65f83d14
......@@ -87,7 +87,8 @@ dependencies {
implementation 'org.sufficientlysecure:html-textview:4.0'
implementation 'com.x5dev:chunk-templates:3.5.0'
implementation 'com.github.Rosemoe.CodeEditor:editor:0.5.2'
implementation 'com.github.Rosemoe.CodeEditor:language-java:0.5.2'
}
......
......@@ -11,6 +11,7 @@ import org.cardelli.R
import org.cardelli.model.Exercise
import org.cardelli.model.ProgrammingExercise
import kotlinx.android.synthetic.main.fragment_practice_programming.*
import io.github.rosemoe.editor.widget.CodeEditor
/**
* Manages the fragment that asks an exercise and collects the user input
......@@ -38,11 +39,12 @@ class ProgrammingExerciseFragment() : Fragment() {
// If exercise was passed, set phrase and solution template
exercise?.let {
this.exercise = it
solutionInput.setText(it.solutionTemplate)
solutionInput2.setText(it.solutionTemplate)
solutionInput2.setEditorLanguage(io.github.rosemoe.editor.langs.java.JavaLanguage())
// exercisePhrase.text = it.phrase
HtmlFiller.fillView(exercisePhrase,it.phrase?:"")
cheatButton.setOnClickListener {
solutionInput.setText(this.exercise.solution)
solutionInput2.setText(this.exercise.solution)
}
}
}
......@@ -52,7 +54,7 @@ class ProgrammingExerciseFragment() : Fragment() {
*/
suspend fun passDataToActivityAndEvaluate() {
val parentFrag = parentFragment as PracticeOverviewFragment
parentFrag.evaluateAnswer(solutionInput.text.toString())
parentFrag.evaluateAnswer(solutionInput2.getText().toString())
}
}
......@@ -5,7 +5,6 @@
android:id="@+id/root_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".fragments.practice.ProgrammingExerciseFragment">
<ScrollView
android:id="@+id/scrollingMultiple"
......@@ -46,7 +45,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
<!-- <EditText
android:id="@+id/solutionInput"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......@@ -61,6 +60,22 @@
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/exercisePhrase" />
-->
<io.github.rosemoe.editor.widget.CodeEditor
android:id="@+id/solutionInput2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:ems="10"
android:gravity="start|top"
android:inputType="textMultiLine"
android:overScrollMode="always"
android:scrollbarStyle="insideInset"
android:scrollbars="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/exercisePhrase"/>
</ScrollView>
<Button
......
......@@ -23,6 +23,7 @@ allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
}
}
......
Supports Markdown
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