Skip to content
This repository has been archived by the owner on Sep 12, 2019. It is now read-only.

Commit

Permalink
New Demo is almost out
Browse files Browse the repository at this point in the history
  • Loading branch information
Hunter Han committed Apr 29, 2019
1 parent 92a5d22 commit 8f8ec69
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 10 deletions.
2 changes: 2 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

<activity android:name=".ViewControllers.GradesRelated.ProgressReportViewController"
android:label="Progress Report Grades"></activity>
<activity android:name=".ViewControllers.GradesRelated.AssignmentsViewController"
android:label="Progress Report Grades"></activity>
</application>

<uses-permission android:name="android.permission.INTERNET" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,89 @@
package com.lingfeishengtian.skymobile.ViewControllers.GradesRelated

import android.graphics.Color
import android.graphics.Point
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.view.Gravity
import android.widget.RelativeLayout
import android.widget.TableRow
import android.widget.TextView
import com.lingfeishengtian.skymobile.ImportantUtilities.UtilsClass.CurrentAssignmentBlocks
import com.lingfeishengtian.skymobile.R
import kotlinx.android.synthetic.main.assignments_view.*

class AssignmentsViewController : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.assignments_view)

TableRefreshOrInit()
}

private fun TableRefreshOrInit(){
AssignmentsTableView.removeAllViews()
AssignmentsTableView.setPadding(15,10,15,10)
AssignmentsTableView.setColumnStretchable(1, true)

for (Assignment in CurrentAssignmentBlocks!!.AssignmentSections) {
var Grade = ""
if (Assignment.grade != null){
Grade = Assignment.grade!!
}
val display = getWindowManager().getDefaultDisplay()
val size = Point()
display.getSize(size)
val Row = makeNewRowFromNameAndGrade(Assignment.name, Grade)
Row.minimumHeight = size.y / 14
AssignmentsTableView.addView(Row)
Row.gravity = Gravity.CENTER_VERTICAL

for (MainSections in Assignment.MinorSections){
val GapRow = TableRow(this)
GapRow.minimumHeight = 10

AssignmentsTableView.addView(makeNewRowFromNameAndGrade(MainSections.name, MainSections.grade))
}

for (AssignmentSection in Assignment.AssignmentList){
val GapRow = TableRow(this)
GapRow.minimumHeight = 10

AssignmentsTableView.addView(makeNewRowFromNameAndGrade(AssignmentSection.name, AssignmentSection.grade.toString()))
}
}
}

private fun makeNewRowFromNameAndGrade(name: String, grade: String): TableRow{
var NeueRow = TableRow(this)
NeueRow.setBackgroundResource(R.drawable.rounded_row)
NeueRow.minimumHeight = root_view.height/2

val AssignmentName = TextView(this)
val Grade = TextView(this)

val display = getWindowManager().getDefaultDisplay()
val size = Point()
display.getSize(size)

val ArrOfViewsInTableRow = mutableListOf(AssignmentName, Grade)
for (View in ArrOfViewsInTableRow){
View.setTextColor(Color.BLACK)
View.minimumHeight = size.y / 20
View.textSize = 20F
View.includeFontPadding = false
View.setPadding(10,0,15,0)

NeueRow.addView(View)
}

AssignmentName.text = (name)
Grade.text = grade
AssignmentName.gravity = Gravity.CENTER_VERTICAL
Grade.gravity = Gravity.CENTER_VERTICAL or Gravity.END

return (NeueRow)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,8 @@ class ProgressReportViewController: AppCompatActivity() {
/**
* "Click it until you fucking make it" algorithm.
*/
Log.d("Course Details", "Clicked")
if(GradeValueAsInt != null){
ClickProgressReportToShowGrades(Course, selectable_terms.selectedItem.toString())
Log.d("Course Details", "CLICK")
//TODO: Loading icon...
ClickedCourse = Course
startRepeatingTask()
Expand Down
24 changes: 16 additions & 8 deletions app/src/main/res/layout/assignments_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,21 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent" android:background="#2F2F2F" tools:context=".ViewControllers.GradesRelated.AssignmentsViewController">
<TextView
android:text="@string/assignment_title"
android:layout_height="match_parent" android:background="#2F2F2F"
tools:context=".ViewControllers.GradesRelated.AssignmentsViewController" android:id="@+id/root_view">
<ScrollView
android:layout_width="match_parent"
android:layout_height="46dp" android:id="@+id/textView5" android:textColor="@android:color/white"
android:textStyle="bold" android:textIsSelectable="false" android:textSize="30sp"/>
<TableLayout
android:layout_width="match_parent"
android:layout_height="match_parent" android:id="@+id/AssignmentsTableView"/>
android:layout_height="match_parent">
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:text="@string/prog_report_title"
android:layout_width="match_parent"
android:layout_height="46dp" android:id="@+id/textView5" android:textColor="@android:color/white"
android:textStyle="bold" android:textIsSelectable="false" android:textSize="30sp"/>
<TableLayout
android:layout_width="match_parent"
android:layout_height="match_parent" android:id="@+id/AssignmentsTableView"/>
</LinearLayout>
</ScrollView>
</LinearLayout>
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@
<string name="StudentID">Student ID</string>
<string name="login">Login</string>
<string name="assignment_title">Assignment Title</string>
<string name="prog_report_title">Progress Report</string>
</resources>

0 comments on commit 8f8ec69

Please sign in to comment.