Skip to content

Commit

Permalink
fix: Add Session Statistics Chart (#1313)
Browse files Browse the repository at this point in the history
  • Loading branch information
Masquerade0097 authored and iamareebjamal committed Aug 8, 2018
1 parent 63a7f70 commit 89606ff
Show file tree
Hide file tree
Showing 2 changed files with 127 additions and 173 deletions.
291 changes: 127 additions & 164 deletions app/src/main/res/layout/event_statistics.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
android:orientation="vertical">

<LinearLayout
android:id="@+id/event_statistics_toggle_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
Expand All @@ -28,12 +29,12 @@
android:id="@+id/tv_event_statistics_toggle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="18dp"
android:layout_marginEnd="@dimen/spacing_small"
android:layout_marginRight="@dimen/spacing_small"
android:layout_marginTop="@dimen/spacing_normal"
android:layout_marginBottom="18dp"
android:text="@string/event_statistics"
android:textSize="@dimen/text_size_normal"/>
android:textSize="@dimen/text_size_normal" />

<android.support.v7.widget.SwitchCompat
android:id="@+id/switch_event_statistics"
Expand All @@ -43,205 +44,167 @@
android:layout_marginRight="@dimen/spacing_normal"
android:layout_marginTop="@dimen/spacing_normal"
android:checked="false"
android:onCheckedChanged='@{ (switch, checked) -> checked ? eventStatisticsLayout.setVisibility(View.VISIBLE) : eventStatisticsLayout.setVisibility(View.GONE) }' />
android:onCheckedChanged='@{ (switch, checked) -> checked ? eventSalesLayout.setVisibility(View.VISIBLE) : eventSalesLayout.setVisibility(View.GONE) }' />

</LinearLayout>

<LinearLayout
android:id="@+id/event_statistics_layout"
android:id="@+id/event_sales_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginBottom="@dimen/spacing_small"
android:orientation="horizontal"
android:visibility="gone"
android:orientation="horizontal">
android:weightSum="200">

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginTop="4dp"
android:layout_marginRight="@dimen/spacing_large"
android:layout_marginEnd="@dimen/spacing_large"
android:id="@+id/event_statistics_layout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="@dimen/spacing_normal"
android:layout_marginTop="@dimen/spacing_small"
android:layout_weight="99"
android:orientation="vertical">

<TextView
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/spacing_normal"
android:layout_marginLeft="@dimen/spacing_normal"
android:layout_marginStart="@dimen/spacing_normal"
style="@style/TextAppearance.AppCompat.Body2"
android:text="@string/speakers"/>
android:layout_gravity="center"
android:orientation="horizontal">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/spacing_normal"
android:layout_marginLeft="@dimen/spacing_normal"
android:layout_marginStart="@dimen/spacing_normal"
style="@style/TextAppearance.AppCompat.Body2"
android:text="@string/sponsors" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{eventStatistics.sessionsAccepted}"
android:textSize="20sp"
android:textStyle="bold" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/spacing_normal"
android:layout_marginLeft="@dimen/spacing_normal"
android:layout_marginStart="@dimen/spacing_normal"
style="@style/TextAppearance.AppCompat.Body2"
android:text="@string/sessions"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text='@{"/" + eventStatistics.sessionsSubmitted}'
android:textSize="@dimen/text_size_small" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/spacing_normal"
android:layout_marginLeft="@dimen/spacing_normal"
android:layout_marginStart="@dimen/spacing_normal"
style="@style/TextAppearance.AppCompat.Body2"
android:text="@string/sessions_submitted" />
</LinearLayout>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/spacing_normal"
android:layout_marginLeft="@dimen/spacing_normal"
android:layout_marginStart="@dimen/spacing_normal"
style="@style/TextAppearance.AppCompat.Body2"
android:text="@string/sessions_accepted" />
android:layout_gravity="center"
android:text="@string/sessions_accepted"
android:textSize="@dimen/text_size_normal" />

<TextView
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/spacing_normal"
android:layout_marginLeft="@dimen/spacing_normal"
android:layout_marginStart="@dimen/spacing_normal"
style="@style/TextAppearance.AppCompat.Body2"
android:text="@string/sessions_confirmed" />
android:layout_gravity="center">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/spacing_normal"
android:layout_marginLeft="@dimen/spacing_normal"
android:layout_marginStart="@dimen/spacing_normal"
style="@style/TextAppearance.AppCompat.Body2"
android:text="@string/sessions_draft" />
<ProgressBar
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:max="100"
android:progress="@{eventStatistics.sessionsSubmitted == 0 ? 0 : (int) ((eventStatistics.sessionsAccepted*100)/eventStatistics.sessionsSubmitted)}" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/spacing_normal"
android:layout_marginLeft="@dimen/spacing_normal"
android:layout_marginStart="@dimen/spacing_normal"
style="@style/TextAppearance.AppCompat.Body2"
android:text="@string/sessions_pending"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/spacing_extra_small"
android:layout_marginStart="@dimen/spacing_extra_small"
android:text='@{(eventStatistics.sessionsSubmitted == 0 ? 0 : (int) ((eventStatistics.sessionsAccepted*100)/eventStatistics.sessionsSubmitted)) + "%"}' />

</LinearLayout>
</LinearLayout>

<LinearLayout
android:layout_width="wrap_content"
<FrameLayout
android:id="@+id/rl_separator"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/spacing_larger"
android:layout_marginStart="@dimen/spacing_larger"
android:orientation="vertical">

<TextView
android:id="@+id/tv_speakers"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/spacing_small"
android:layout_marginLeft="@dimen/spacing_normal"
android:layout_marginStart="@dimen/spacing_normal"
android:textSize="@dimen/text_size_large"
android:textStyle="bold"
android:text="@{ BindingAdapters.longToStr(eventStatistics.speakers) }"/>
android:layout_marginBottom="@dimen/spacing_small"
android:layout_marginTop="@dimen/spacing_small"
android:layout_weight="1"
android:background="@color/color_bottom_surface" />

<TextView
android:id="@+id/tv_sponsors"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/spacing_small"
android:layout_marginLeft="@dimen/spacing_normal"
android:layout_marginStart="@dimen/spacing_normal"
android:textSize="@dimen/text_size_large"
android:textStyle="bold"
android:text="@{ BindingAdapters.longToStr(eventStatistics.sponsors) }" />

<TextView
android:id="@+id/tv_sessions"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/spacing_small"
android:layout_marginLeft="@dimen/spacing_normal"
android:layout_marginStart="@dimen/spacing_normal"
android:textSize="@dimen/text_size_large"
android:textStyle="bold"
android:text="@{ BindingAdapters.longToStr(eventStatistics.sessions) }" />

<TextView
android:id="@+id/tv_sessionsSubmitted"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/spacing_small"
android:layout_marginLeft="@dimen/spacing_normal"
android:layout_marginStart="@dimen/spacing_normal"
android:textSize="@dimen/text_size_large"
android:textStyle="bold"
android:text="@{ BindingAdapters.longToStr(eventStatistics.sessionsSubmitted) }" />

<TextView
android:id="@+id/tv_sessionsAccepted"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/spacing_small"
android:layout_marginLeft="@dimen/spacing_normal"
android:layout_marginStart="@dimen/spacing_normal"
android:textSize="@dimen/text_size_large"
android:textStyle="bold"
android:text="@{ BindingAdapters.longToStr(eventStatistics.sessionsAccepted) }" />

<TextView
android:id="@+id/tv_sessionsConfirmed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/spacing_small"
android:layout_marginLeft="@dimen/spacing_normal"
android:layout_marginStart="@dimen/spacing_normal"
android:textSize="@dimen/text_size_large"
android:textStyle="bold"
android:text="@{ BindingAdapters.longToStr(eventStatistics.sessionsConfirmed) }" />

<TextView
android:id="@+id/tv_sessionsDraft"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/spacing_small"
android:layout_marginLeft="@dimen/spacing_normal"
android:layout_marginStart="@dimen/spacing_normal"
android:textSize="@dimen/text_size_large"
android:textStyle="bold"
android:text="@{ BindingAdapters.longToStr(eventStatistics.sessionsDraft) }"/>

<TextView
android:id="@+id/tv_sessionsPending"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/spacing_small"
android:layout_marginLeft="@dimen/spacing_normal"
android:layout_marginStart="@dimen/spacing_normal"
android:textSize="@dimen/text_size_large"
android:textStyle="bold"
android:text="@{ BindingAdapters.longToStr(eventStatistics.sessionsPending) }"/>
<LinearLayout
android:id="@+id/sales_statistics_layout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="99"
android:orientation="horizontal">

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginEnd="@dimen/spacing_normal"
android:layout_marginRight="@dimen/spacing_normal"
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
android:layout_marginTop="4dp"
android:orientation="vertical">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/spacing_normal"
android:layout_marginLeft="@dimen/spacing_large"
android:layout_marginStart="@dimen/spacing_large"
android:textSize="@dimen/text_size_normal"
android:text="@string/speakers" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/spacing_normal"
android:layout_marginLeft="@dimen/spacing_large"
android:layout_marginStart="@dimen/spacing_large"
android:textSize="@dimen/text_size_normal"
android:text="@string/sponsors" />

</LinearLayout>

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
android:layout_marginTop="@dimen/spacing_extra_small"
android:layout_marginRight="@dimen/spacing_normal"
android:layout_marginEnd="@dimen/spacing_normal"
android:orientation="vertical">

<TextView
android:id="@+id/tv_speakers"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/spacing_normal"
android:layout_marginLeft="@dimen/spacing_large"
android:layout_marginStart="@dimen/spacing_large"
android:text="@{ BindingAdapters.longToStr(eventStatistics.speakers) }"
android:textSize="@dimen/text_size_normal" />

<TextView
android:id="@+id/tv_sponsors"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/spacing_normal"
android:layout_marginLeft="@dimen/spacing_large"
android:layout_marginStart="@dimen/spacing_large"
android:text="@{ BindingAdapters.longToStr(eventStatistics.sponsors) }"
android:textSize="@dimen/text_size_normal"/>

</LinearLayout>

</LinearLayout>

</LinearLayout>

<FrameLayout
android:id="@+id/frame_separator_four"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/color_shadow"/>
android:layout_height="@dimen/spacing_small"
android:layout_marginTop="@dimen/spacing_small"
android:background="@color/color_bottom_surface" />

</LinearLayout>
</layout>
9 changes: 0 additions & 9 deletions app/src/main/res/layout/fragment_event_details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -326,15 +326,6 @@

</FrameLayout>

<FrameLayout
android:id="@+id/frame_separator_six"
android:layout_width="match_parent"
android:layout_height="@dimen/spacing_small"
android:background="@color/color_bottom_surface"
bind:layout_constraintEnd_toEndOf="parent"
bind:layout_constraintStart_toStartOf="parent"
bind:layout_constraintTop_toBottomOf="@id/event_statistics_frame" />

</android.support.constraint.ConstraintLayout>

</android.support.v4.widget.NestedScrollView>
Expand Down

0 comments on commit 89606ff

Please sign in to comment.