Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dining redesign: open until subtitle, updated day chips, availability card redesign, improved chart and menus #48

Merged
merged 33 commits into from
Aug 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
2098eda
added date to day chips by making chips into radiobuttons
kaushikravikumar May 9, 2020
4c66c5c
removed lite_lunch logic, since its grouped with lunch in dining menu…
kaushikravikumar May 9, 2020
fc468a5
made toolbar include subtitle with openclose info
kaushikravikumar Jun 14, 2020
2b478a0
moved parseTime function to fluxutil
kaushikravikumar Jun 14, 2020
f4960d4
added next day to facilityhours endpoint
kaushikravikumar Jun 14, 2020
3805277
removed duplicate operating hours request
kaushikravikumar Jun 19, 2020
5dd527f
created two separate variables to store operating hours: one for chec…
kaushikravikumar Jun 21, 2020
c4e3857
added curr date textview
kaushikravikumar Jun 21, 2020
dd50c58
changed so open/closed text only colors red or green for open or clos…
kaushikravikumar Jun 21, 2020
9c6779a
removed extra line
kaushikravikumar Jun 21, 2020
9c0698d
Bump Gradle, package versions
kungpaogao Jun 26, 2020
5243351
Implement dynamic chips (shows today first)
kungpaogao Jun 26, 2020
e658a89
Remove unnecessary outline
kungpaogao Jun 26, 2020
47758a5
Format code
kungpaogao Jun 27, 2020
989e567
Implement basic layout for new availability card
kungpaogao Jun 27, 2020
7cdbde8
Availability number now updates according to crowdedness
kungpaogao Jun 27, 2020
9753081
Availability card displays live max capacity
kungpaogao Jun 27, 2020
154c8b3
made all dates yyyy-mm-dd
kaushikravikumar Jun 27, 2020
658abd4
fixed double loading of historical chart bug
kaushikravikumar Jun 27, 2020
a2fe498
Move section headers outside of card
kungpaogao Jun 27, 2020
aa9fa53
Merge branch 'dining_redesign' of https://github.com/cornell-dti/camp…
kungpaogao Jun 27, 2020
450baef
Implement color changes for availability card
kungpaogao Jun 27, 2020
25ac06b
Update green/teal color
kungpaogao Jul 5, 2020
e2b6ba0
Update menu UI to match design mockups
kungpaogao Jul 5, 2020
ee75f8d
added last updated text
kaushikravikumar Jul 5, 2020
a9af916
merge branch 'dining_redesign' of https://github.com/cornell-dti/camp…
kaushikravikumar Jul 5, 2020
ab97968
changed color of is it accurate text
kaushikravikumar Jul 5, 2020
ab79278
fixed spacing between last updated text and next component below and …
kaushikravikumar Jul 5, 2020
8a44223
Fix operating hours not displaying on Android
kungpaogao Jul 11, 2020
9223977
Update spacing for operating hours in historical data card
kungpaogao Jul 11, 2020
42c532f
Merge remote-tracking branch 'origin/dining_redesign' into dining_red…
kungpaogao Jul 11, 2020
995f337
Fix layout scaling for date selection buttons
kungpaogao Jul 11, 2020
975977e
Implement graying out of chart + other chart improvements
kungpaogao Jul 11, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Density/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.3.61'
ext.kotlin_version = '1.3.72'
repositories {
jcenter()
google()
Expand Down Expand Up @@ -50,17 +50,17 @@ dependencies {
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta4'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta7'
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
implementation 'com.google.firebase:firebase-core:17.2.3'
implementation 'com.google.firebase:firebase-auth:19.2.0'
implementation 'com.google.firebase:firebase-core:17.4.3'
implementation 'com.google.firebase:firebase-auth:19.3.1'
implementation 'com.google.gms:google-services:4.3.3'
implementation 'com.google.android.gms:play-services-gcm:17.0.0'
implementation 'com.android.volley:volley:1.1.0'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'androidx.core:core-ktx:1.2.0'
implementation 'androidx.core:core-ktx:1.3.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
apply plugin: 'com.google.gms.google-services'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
package org.cornelldti.density.density.colorbarutil

import android.graphics.Canvas
import android.graphics.Path
import android.graphics.RectF

import com.github.mikephil.charting.animation.ChartAnimator
import com.github.mikephil.charting.buffer.BarBuffer
import com.github.mikephil.charting.data.BarData
import com.github.mikephil.charting.data.BarEntry
import com.github.mikephil.charting.interfaces.dataprovider.BarDataProvider
import com.github.mikephil.charting.interfaces.datasets.IBarDataSet
import com.github.mikephil.charting.renderer.BarChartRenderer
import com.github.mikephil.charting.utils.Transformer
import com.github.mikephil.charting.utils.Utils
import com.github.mikephil.charting.utils.ViewPortHandler
import kotlin.math.ceil

class ColorBarChartRenderer(chart: BarDataProvider, animator: ChartAnimator,
viewPortHandler: ViewPortHandler) : BarChartRenderer(chart, animator, viewPortHandler) {


private val path = Path()
private val mBarShadowRectBuffer = RectF()
private val radii = floatArrayOf(
7f, 7f, // top left
7f, 7f, // top right
0f, 0f, // bottom right
0f, 0f // bottom left
)


override fun drawDataSet(c: Canvas, dataSet: IBarDataSet, index: Int) {

Expand All @@ -42,10 +47,8 @@ class ColorBarChartRenderer(chart: BarDataProvider, animator: ChartAnimator,
val barWidthHalf = barWidth / 2.0f
var x: Float

var i = 0
val count = Math.min(Math.ceil((dataSet.entryCount.toFloat() * phaseX).toDouble()).toInt(), dataSet.entryCount)
while (i < count) {

val count = Math.min(ceil((dataSet.entryCount.toFloat() * phaseX).toDouble()).toInt(), dataSet.entryCount)
for (i in 0 until count) {
val e = dataSet.getEntryForIndex(i)

x = e.x
Expand All @@ -56,7 +59,6 @@ class ColorBarChartRenderer(chart: BarDataProvider, animator: ChartAnimator,
trans.rectValueToPixel(mBarShadowRectBuffer)

if (!mViewPortHandler.isInBoundsLeft(mBarShadowRectBuffer.right)) {
i++
continue
}

Expand All @@ -67,7 +69,6 @@ class ColorBarChartRenderer(chart: BarDataProvider, animator: ChartAnimator,
mBarShadowRectBuffer.bottom = mViewPortHandler.contentBottom()

c.drawRoundRect(mBarShadowRectBuffer, 7f, 7f, mShadowPaint)
i++
}
}

Expand All @@ -88,11 +89,9 @@ class ColorBarChartRenderer(chart: BarDataProvider, animator: ChartAnimator,
mRenderPaint.color = dataSet.color
}

var j = 0
while (j < buffer.size()) {
for (j in 0 until buffer.size() step 4) {

if (!mViewPortHandler.isInBoundsLeft(buffer.buffer[j + 2])) {
j += 4
continue
}

Expand All @@ -105,18 +104,27 @@ class ColorBarChartRenderer(chart: BarDataProvider, animator: ChartAnimator,
mRenderPaint.color = dataSet.getColor(j / 4)
}

c.drawRoundRect(buffer.buffer[j], buffer.buffer[j + 1], buffer.buffer[j + 2],
buffer.buffer[j + 3], 7f, 7f, mRenderPaint)
//c.drawRect(buffer.buffer[j], buffer.buffer[j + 1], buffer.buffer[j + 2],
// buffer.buffer[j + 3], mRenderPaint);
if (mRenderPaint.color == dataSet.colors[4]) {
c.drawRect(buffer.buffer[j],
50f,
buffer.buffer[j + 2],
buffer.buffer[j + 3], mRenderPaint)
} else {
path.reset()
path.addRoundRect(
buffer.buffer[j] + 2,
buffer.buffer[j + 1],
buffer.buffer[j + 2] - 2,
buffer.buffer[j + 3],
radii,
Path.Direction.CW)
c.drawPath(path, mRenderPaint)
}

if (drawBorder) {
//c.drawRect(buffer.buffer[j], buffer.buffer[j + 1], buffer.buffer[j + 2],
// buffer.buffer[j + 3], mBarBorderPaint);
c.drawRoundRect(buffer.buffer[j], buffer.buffer[j + 1], buffer.buffer[j + 2],
buffer.buffer[j + 3], 7f, 7f, mBarBorderPaint)
}
j += 4
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ class ColorBarDataSet(y_vals: List<BarEntry>, label: String) : BarDataSet(y_vals
colors[2]
} else if (getEntryForIndex(index).y >= 0.25) {
colors[1]
} else {
} else if (getEntryForIndex(index).y > 0) {
colors[0]
} else {
colors[4]
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,16 @@ class ColorBarMarkerView(context: Context, layoutResource: Int) : MarkerView(con
if (is24) {
time = if (eX.toInt() + 7 < 10) "0" + (eX.toInt() + 7) + ":00 " else (eX.toInt() + 7).toString() + ":00 "
} else {
if (eX <= 4) {
time = (eX.toInt() + 7).toString() + "am "
} else if (eX == 5f) {
time = "12pm "
} else {
time = (eX.toInt() - 5).toString() + "pm "
time = when {
eX <= 4 -> {
(eX.toInt() + 7).toString() + "am "
}
eX == 5f -> {
"12pm "
}
else -> {
(eX.toInt() - 5).toString() + "pm "
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ data class MenuClass(
val breakfastItems: List<MenuItem>,
val brunchItems: List<MenuItem>,
val lunchItems: List<MenuItem>,
val liteLunchItems: List<MenuItem>,
val dinnerItems: List<MenuItem>
)

Expand Down
Loading