Skip to content

Commit

Permalink
fluctuation & status badge
Browse files Browse the repository at this point in the history
  • Loading branch information
HITGIF committed Jan 21, 2018
1 parent ad5796f commit bb55b8e
Show file tree
Hide file tree
Showing 52 changed files with 821 additions and 175 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 12 additions & 12 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ apply plugin: 'com.jakewharton.butterknife'

android {
compileSdkVersion 27
buildToolsVersion '27.0.1'
buildToolsVersion '27.0.2'
defaultConfig {
applicationId 'com.carbonylgroup.schoolpower'
minSdkVersion 21
targetSdkVersion 27
versionCode 9
versionName "1.1.4"
versionCode 10
versionName "1.1.5"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand All @@ -36,24 +36,24 @@ dependencies {
})
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
compile('com.mikepenz:aboutlibraries:5.9.6@aar') { transitive = true }
compile 'com.android.support:appcompat-v7:27.0.1'
compile 'com.android.support:design:27.0.1'
compile 'com.android.support:cardview-v7:27.0.1'
compile 'com.android.support:preference-v7:27.0.1'
compile 'com.android.support:preference-v14:27.0.1'
compile 'com.android.support:appcompat-v7:27.0.2'
compile 'com.android.support:design:27.0.2'
compile 'com.android.support:cardview-v7:27.0.2'
compile 'com.android.support:preference-v7:27.0.2'
compile 'com.android.support:preference-v14:27.0.2'
compile 'com.ramotion.foldingcell:folding-cell:1.0.1'
compile 'commons-io:commons-io:2.5'
compile 'de.danielbechler:java-object-diff:0.95-RC5'
compile 'com.android.support:support-v4:27.0.1'
compile 'com.android.support:support-v4:27.0.2'
compile 'com.github.PhilJay:MPAndroidChart:v3.0.2'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.android.gms:play-services-ads:11.6.0'
compile 'com.google.android.gms:play-services-ads:11.8.0'
compile 'com.gelitenight.waveview:waveview:1.0.0'
compile 'com.android.support:percent:27.0.1'
compile 'com.android.support:percent:27.0.2'
compile 'com.github.premnirmal:TextCounter:1.1.0'
compile 'com.github.ceryle:SegmentedButton:v1.2.2'
testCompile 'junit:junit:4.12'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
}
repositories {
mavenCentral()
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@

</application>

</manifest>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,22 @@ class MainActivity : TransitionHelper.MainActivity(), NavigationView.OnNavigatio
for (item in newAssignmentListCollection) {
// if no item in oldAssignmentListCollection has the same title, score and date as those of the new one, then the assignment should be marked.
val found = oldAssignmentListCollection.any { it.title == item.title && it.score == item.score && it.date == item.date && !it.isNew }
if (!found) item.isNew = true
if (!found) {
item.isNew = true

var oldPercent = 0
var newPercent = 0
var oldPercentStr = "--"
var newPercentStr = "--"
if (utils.getLatestPeriodGrade(oldSubjects[i]) != null)
oldPercentStr = utils.getLatestPeriodGrade(oldSubjects[i])!!.percentage
if (utils.getLatestPeriodGrade(subjects!![i]) != null)
newPercentStr = utils.getLatestPeriodGrade(subjects!![i])!!.percentage
if (oldPercentStr != "--") oldPercent = oldPercentStr.toInt()
if (newPercentStr != "--") newPercent = newPercentStr.toInt()

subjects!![i].margin = newPercent - oldPercent
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ class SettingsActivity : AppCompatActivity() {
val uri = Uri.parse(getString(R.string.bug_report_email))
val intent = Intent(Intent.ACTION_SENDTO, uri)
intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.bug_report_email_subject))
intent.putExtra(Intent.EXTRA_TEXT, getString(R.string.bug_report_email_content))
intent.putExtra(Intent.EXTRA_TEXT, String.format(getString(R.string.bug_report_email_content),
activity.packageManager.getPackageInfo("com.carbonylgroup.schoolpower", 0).versionName))
startActivity(Intent.createChooser(intent, getString(R.string.choose_email_app)))
true
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package com.carbonylgroup.schoolpower.adapter

import android.content.Context
import android.support.v7.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import com.carbonylgroup.schoolpower.R
import com.carbonylgroup.schoolpower.R2
import com.carbonylgroup.schoolpower.data.AssignmentItem
import com.carbonylgroup.schoolpower.utils.Utils
import kotterknife.bindView

/**
* Created by carbonyl on 21/01/2018.
*/

class AssignmentFlagAdapter(private val context: Context, private val assignmentItem: AssignmentItem) :
RecyclerView.Adapter<AssignmentFlagAdapter.AssignmentFlagViewHolder>() {

private val inflater: LayoutInflater = LayoutInflater.from(context)
private val utils: Utils = Utils(context)

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): AssignmentFlagViewHolder {

val view = inflater.inflate(R.layout.assignment_flag_item, parent, false)
return AssignmentFlagViewHolder(view)
}

override fun onBindViewHolder(viewHolder: AssignmentFlagViewHolder, position: Int) {

val (icon, descrip) = utils.getAssignmentFlag(assignmentItem.trueFlags[position].first)
viewHolder.assignment_flag_image.setImageResource(icon)
viewHolder.assignment_flag_description.text = descrip
}

override fun getItemCount(): Int {
return assignmentItem.trueFlags.count()
}

class AssignmentFlagViewHolder internal constructor(view: View) : RecyclerView.ViewHolder(view) {
val assignment_flag_image: ImageView by bindView(R2.id.assignment_flag_image)
val assignment_flag_description: TextView by bindView(R2.id.assignment_flag_description)
}
}
Loading

0 comments on commit bb55b8e

Please sign in to comment.