ShowHabit: Refactor subtitle and overview

This commit is contained in:
2016-06-22 08:48:08 -04:00
parent b6ed33b1e6
commit a060cbe578
14 changed files with 664 additions and 359 deletions

View File

@@ -60,13 +60,13 @@
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<!--<org.isoron.uhabits.ui.habits.list.views.HabitCardView-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content" />-->
<org.isoron.uhabits.ui.habits.list.views.HabitCardView
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<!--<org.isoron.uhabits.ui.habits.list.views.HabitCardView-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content" />-->
<org.isoron.uhabits.ui.habits.list.views.HabitCardView
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<!--<org.isoron.uhabits.ui.habits.list.views.HabitCardView-->
<!--android:layout_width="match_parent"-->

View File

@@ -20,7 +20,6 @@
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:habit="http://isoron.org/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
@@ -30,178 +29,20 @@
<LinearLayout
style="@style/CardList"
android:clipToPadding="false"
tools:context=".ui.habits.show.ShowHabitActivity">
android:clipToPadding="false">
<LinearLayout
android:id="@+id/subtitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?headerBackgroundColor"
android:elevation="2dp"
android:orientation="vertical"
android:paddingBottom="10dp"
android:paddingLeft="60dp"
android:paddingStart="60dp"
android:paddingRight="10dp"
android:paddingEnd="10dp"
android:paddingTop="15dp">
<org.isoron.uhabits.ui.habits.show.views.SubtitleCardView
style="@style/ShowHabit.Subtitle"
android:id="@+id/subtitle"/>
<TextView
android:id="@+id/questionLabel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:textColor="?mediumContrastTextColor"
android:textSize="@dimen/regularTextSize"
/>
<!--<View-->
<!--android:id="@+id/headerShadow"-->
<!--style="@style/ToolbarShadow"/>-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:id="@+id/frequencyIcon"
android:layout_width="18dp"
android:layout_height="18dp"
android:layout_marginRight="5dp"
android:layout_marginEnd="5dp"
android:alpha="0.3"
android:src="?iconFrequency"
/>
<TextView
android:id="@+id/frequencyLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/every_day"
android:textColor="?mediumContrastTextColor"
android:textSize="@dimen/smallTextSize"
/>
<ImageView
android:id="@+id/reminderIcon"
android:layout_width="18dp"
android:layout_height="18dp"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_marginRight="5dp"
android:layout_marginEnd="5dp"
android:alpha="0.3"
android:src="?iconReminder"
/>
<TextView
android:id="@+id/reminderLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="1dp"
android:textColor="?mediumContrastTextColor"
android:textSize="@dimen/smallTextSize"
/>
</LinearLayout>
</LinearLayout>
<View
android:id="@+id/headerShadow"
style="@style/ToolbarShadow"/>
<LinearLayout
style="@style/Card"
<org.isoron.uhabits.ui.habits.show.views.OverviewCardView
android:id="@+id/overview"
android:paddingTop="12dp"
android:gravity="start">
<TextView
android:id="@+id/tvOverview"
style="@style/CardHeader"
android:text="@string/overview"/>
<LinearLayout
android:id="@+id/llOverview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<FrameLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="5">
<org.isoron.uhabits.ui.habits.show.views.RingView
android:id="@+id/scoreRing"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center"
habit:percentage="0"
habit:textSize="12"
habit:thickness="5"/>
</FrameLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="4"
android:orientation="vertical">
<TextView
android:id="@+id/scoreLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/score"
android:textColor="?mediumContrastTextColor"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="4"
android:orientation="vertical">
<TextView
android:id="@+id/monthDiffLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/month"
android:textColor="?mediumContrastTextColor"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="4"
android:orientation="vertical">
<TextView
android:id="@+id/yearDiffLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/year"
android:textColor="?mediumContrastTextColor"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
style="@style/Card" />
<RelativeLayout
style="@style/Card"

View File

@@ -0,0 +1,109 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2016 Álinson Santos Xavier <isoron@gmail.com>
~
~ This file is part of Loop Habit Tracker.
~
~ Loop Habit Tracker is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by the
~ Free Software Foundation, either version 3 of the License, or (at your
~ option) any later version.
~
~ Loop Habit Tracker is distributed in the hope that it will be useful, but
~ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
~ more details.
~
~ You should have received a copy of the GNU General Public License along
~ with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:habit="http://isoron.org/android">
<TextView
android:id="@+id/title"
style="@style/CardHeader"
android:text="@string/overview"/>
<LinearLayout
android:id="@+id/llOverview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<FrameLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="5">
<org.isoron.uhabits.ui.habits.show.views.RingView
android:id="@+id/scoreRing"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center"
habit:percentage="0"
habit:textSize="12"
habit:thickness="5"/>
</FrameLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="4"
android:orientation="vertical">
<TextView
android:id="@+id/scoreLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/score"
android:textColor="?mediumContrastTextColor"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="4"
android:orientation="vertical">
<TextView
android:id="@+id/monthDiffLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/month"
android:textColor="?mediumContrastTextColor"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="4"
android:orientation="vertical">
<TextView
android:id="@+id/yearDiffLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/year"
android:textColor="?mediumContrastTextColor"/>
</LinearLayout>
</LinearLayout>
</merge>

View File

@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2016 Álinson Santos Xavier <isoron@gmail.com>
~
~ This file is part of Loop Habit Tracker.
~
~ Loop Habit Tracker is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by the
~ Free Software Foundation, either version 3 of the License, or (at your
~ option) any later version.
~
~ Loop Habit Tracker is distributed in the hope that it will be useful, but
~ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
~ more details.
~
~ You should have received a copy of the GNU General Public License along
~ with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="?windowBackgroundColor"
android:clipToPadding="false"
android:fillViewport="true"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
style="@style/Toolbar"
app:title="Meditation"
android:background="@color/deep_orange_700"
app:popupTheme="?toolbarPopupTheme"
android:elevation="1dp"/>
<LinearLayout
style="@style/CardList"
android:clipToPadding="false">
<org.isoron.uhabits.ui.habits.show.views.SubtitleCardView
android:id="@+id/subtitleView"
style="@style/ShowHabit.Subtitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<org.isoron.uhabits.ui.habits.show.views.OverviewCardView
android:paddingTop="12dp"
style="@style/Card" />
</LinearLayout>
</LinearLayout>

View File

@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2016 Álinson Santos Xavier <isoron@gmail.com>
~
~ This file is part of Loop Habit Tracker.
~
~ Loop Habit Tracker is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by the
~ Free Software Foundation, either version 3 of the License, or (at your
~ option) any later version.
~
~ Loop Habit Tracker is distributed in the hope that it will be useful, but
~ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
~ more details.
~
~ You should have received a copy of the GNU General Public License along
~ with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<TextView
android:id="@+id/questionLabel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:textColor="?mediumContrastTextColor"
android:textSize="@dimen/regularTextSize"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:id="@+id/frequencyIcon"
android:layout_width="18dp"
android:layout_height="18dp"
android:layout_marginEnd="5dp"
android:layout_marginRight="5dp"
android:alpha="0.3"
android:src="?iconFrequency"
/>
<TextView
android:id="@+id/frequencyLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/every_day"
android:textColor="?mediumContrastTextColor"
android:textSize="@dimen/smallTextSize"
/>
<ImageView
android:id="@+id/reminderIcon"
android:layout_width="18dp"
android:layout_height="18dp"
android:layout_marginEnd="5dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="5dp"
android:layout_marginStart="10dp"
android:alpha="0.3"
android:src="?iconReminder"
/>
<TextView
android:id="@+id/reminderLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="1dp"
android:textColor="?mediumContrastTextColor"
android:textSize="@dimen/smallTextSize"
/>
</LinearLayout>
</merge>