Refactor ShowHabit fragment; break widgets

This commit is contained in:
2016-06-24 08:39:48 -04:00
parent a11ad6e909
commit efd0d1e051
39 changed files with 1034 additions and 955 deletions

View File

@@ -19,7 +19,6 @@
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:habit="http://isoron.org/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
@@ -31,7 +30,7 @@
style="@style/CardList"
android:clipToPadding="false">
<org.isoron.uhabits.ui.habits.show.views.SubtitleCard
<org.isoron.uhabits.ui.habits.show.views.cards.SubtitleCard
style="@style/ShowHabit.Subtitle"
android:id="@+id/subtitleCard"/>
@@ -39,74 +38,29 @@
<!--android:id="@+id/headerShadow"-->
<!--style="@style/ToolbarShadow"/>-->
<org.isoron.uhabits.ui.habits.show.views.OverviewCard
<org.isoron.uhabits.ui.habits.show.views.cards.OverviewCard
android:id="@+id/overviewCard"
android:paddingTop="12dp"
style="@style/Card" />
<org.isoron.uhabits.ui.habits.show.views.ScoreCard
<org.isoron.uhabits.ui.habits.show.views.cards.ScoreCard
android:id="@+id/strengthCard"
style="@style/Card"
android:gravity="center" />
<LinearLayout
<org.isoron.uhabits.ui.habits.show.views.cards.HistoryCard
android:id="@+id/historyCard"
style="@style/Card"
android:clipToPadding="false"
android:orientation="vertical"
android:paddingBottom="0dp">
android:paddingBottom="0dp"
android:gravity="center" />
<TextView
android:id="@+id/tvHistory"
style="@style/CardHeader"
android:text="@string/history"/>
<org.isoron.uhabits.ui.habits.show.views.cards.StreakCard
android:id="@+id/streakCard"
style="@style/Card"/>
<org.isoron.uhabits.ui.habits.show.views.HistoryView
android:id="@+id/historyView"
android:layout_width="match_parent"
android:layout_height="160dp"/>
<org.isoron.uhabits.ui.habits.show.views.cards.FrequencyCard
android:id="@+id/frequencyCard"
style="@style/Card"/>
<Button
android:id="@+id/btEditHistory"
style="?android:borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/ic_action_edit_light"
android:text="@string/edit"
android:textColor="@color/grey_400"
android:textSize="@dimen/smallTextSize"/>
</LinearLayout>
<LinearLayout
style="@style/Card"
android:orientation="vertical">
<TextView
android:id="@+id/tvStreaks"
style="@style/CardHeader"
android:text="@string/best_streaks"/>
<org.isoron.uhabits.ui.habits.show.views.StreakChart
android:id="@+id/streakChart"
android:layout_width="match_parent"
android:layout_height="200dp"/>
</LinearLayout>
<LinearLayout
style="@style/Card"
android:orientation="vertical">
<TextView
android:id="@+id/tvWeekdayFreq"
style="@style/CardHeader"
android:text="@string/frequency"/>
<org.isoron.uhabits.ui.habits.show.views.FrequencyChart
android:id="@+id/punchcardView"
android:layout_width="match_parent"
android:layout_height="200dp"/>
</LinearLayout>
</LinearLayout>
</ScrollView>

View File

@@ -19,30 +19,13 @@
-->
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<android.support.v7.widget.AppCompatSpinner
android:id="@+id/spinner"
android:layout_width="wrap_content"
android:layout_height="22dp"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:entries="@array/strengthIntervalNames"
android:theme="@style/SmallSpinner"
/>
<TextView
android:id="@+id/title"
style="@style/CardHeader"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:text="@string/habit_strength"/>
android:text="@string/frequency"/>
<org.isoron.uhabits.ui.habits.show.views.ScoreChart
android:id="@+id/scoreView"
<org.isoron.uhabits.ui.habits.show.views.charts.FrequencyChart
android:id="@+id/frequencyChart"
android:layout_width="match_parent"
android:layout_height="220dp"
android:layout_below="@id/title"/>
android:layout_height="200dp"/>
</merge>

View File

@@ -0,0 +1,48 @@
<?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"
android:clipToPadding="false"
android:orientation="vertical"
android:paddingBottom="0dp">
<TextView
android:id="@+id/title"
style="@style/CardHeader"
android:text="@string/history"/>
<org.isoron.uhabits.ui.habits.show.views.charts.HistoryChart
android:id="@+id/historyChart"
android:layout_width="match_parent"
android:layout_height="160dp"/>
<Button
android:id="@+id/edit"
style="?android:borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/ic_action_edit_light"
android:text="@string/edit"
android:textColor="@color/grey_400"
android:textSize="@dimen/smallTextSize"/>
</merge>

View File

@@ -1,57 +0,0 @@
<?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"
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"
android:background="@color/deep_orange_700"
android:elevation="1dp"
app:popupTheme="?toolbarPopupTheme"
app:title="Meditation"/>
<LinearLayout
style="@style/CardList"
android:clipToPadding="false">
<org.isoron.uhabits.ui.habits.show.views.SubtitleCard
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.OverviewCard
style="@style/Card"
android:paddingTop="12dp"/>
<org.isoron.uhabits.ui.habits.show.views.ScoreCard
style="@style/Card"
android:paddingTop="12dp"/>
</LinearLayout>
</LinearLayout>

View File

@@ -0,0 +1,52 @@
<?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">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.AppCompatSpinner
android:id="@+id/spinner"
android:layout_width="wrap_content"
android:layout_height="22dp"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:entries="@array/strengthIntervalNames"
android:theme="@style/SmallSpinner"
/>
<TextView
android:id="@+id/title"
style="@style/CardHeader"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:text="@string/habit_strength"/>
<org.isoron.uhabits.ui.habits.show.views.charts.ScoreChart
android:id="@+id/scoreView"
android:layout_width="match_parent"
android:layout_height="220dp"
android:layout_below="@id/title"/>
</RelativeLayout>
</merge>

View File

@@ -0,0 +1,31 @@
<?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/title"
style="@style/CardHeader"
android:text="@string/best_streaks"/>
<org.isoron.uhabits.ui.habits.show.views.charts.StreakChart
android:id="@+id/streakChart"
android:layout_width="match_parent"
android:layout_height="200dp"/>
</merge>