Major refactoring of ListHabitsActivity

This commit is contained in:
2016-05-29 11:40:42 -04:00
parent 3ffa079e24
commit 7e8a2a0c1c
123 changed files with 5764 additions and 2701 deletions

View File

@@ -19,24 +19,36 @@
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:dslv="http://schemas.android.com/apk/res-auto"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff">
android:background="?windowBackgroundColor">
<org.isoron.uhabits.ui.habits.list.HabitListView
android:id="@+id/listView"
dslv:drag_enabled="true"
dslv:drag_start_mode="onLongPress"
dslv:sort_enabled="true"
dslv:track_drag_sort="false"
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
style="@style/Toolbar"
app:popupTheme="?toolbarPopupTheme"
android:layout_alignParentTop="true"/>
<org.isoron.uhabits.ui.habits.list.views.HeaderView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/toolbar"
android:id="@+id/header"
style="@style/ListHabits.Header"/>
<org.isoron.uhabits.ui.habits.list.views.HabitCardListView
android:id="@+id/listView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?windowBackgroundColor"
android:paddingTop="@dimen/checkmarkHeight"
android:layout_height="match_parent"
android:divider="?windowBackgroundColor"
android:dividerHeight="1dp"
android:listSelector="@android:color/transparent"
android:dividerHeight="1dp"/>
app:drag_start_mode="onLongPress"
app:sort_enabled="true"
app:track_drag_sort="false"
android:layout_below="@id/header"/>
<LinearLayout
android:id="@+id/llEmpty"
@@ -57,60 +69,25 @@
</LinearLayout>
<LinearLayout
android:id="@+id/header"
style="@style/ListHabits.Header">
<TextView
android:id="@+id/tvStarHeader"
style="@style/ListHabits.Star"/>
<TextView
android:id="@+id/tvNameHeader"
style="@style/ListHabits.Label"
android:text=""/>
<LinearLayout
android:id="@+id/llButtonsHeader"
style="@style/ListHabits.CheckmarkPanel"/>
</LinearLayout>
<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="?android:attr/progressBarStyleHorizontal"
android:layout_below="@+id/header"
android:layout_marginTop="@dimen/progressbarOffset"
android:visibility="gone"
/>
<LinearLayout
android:id="@+id/llHint"
<org.isoron.uhabits.ui.habits.list.views.HintView
android:id="@+id/hintView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/indigo_500"
android:layout_alignParentBottom="true"
android:orientation="vertical"
android:animateLayoutChanges="true"
android:visibility="invisible"
style="@style/Card">
android:layout_alignParentBottom="true"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hint_title"
android:textStyle="bold"
android:textColor="@color/white"
android:layout_weight="5"/>
<TextView
android:id="@+id/hintContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/white"
android:layout_weight="5"/>
</LinearLayout>
<View
android:id="@+id/toolbarShadow"
android:layout_below="@id/toolbar"
style="@style/ToolbarShadow"/>
</RelativeLayout>

View File

@@ -1,46 +0,0 @@
<!--
~ 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/>.
-->
<RelativeLayout android:id="@+id/container"
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="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
tools:ignore="MergeRootFrame">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
style="@style/Toolbar"
app:popupTheme="?toolbarPopupTheme"/>
<fragment
android:id="@+id/fragment1"
android:name="org.isoron.uhabits.ui.habits.list.ListHabitsFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/toolbar"
tools:layout="@layout/list_habits_fragment"/>
<View
android:id="@+id/toolbarShadow"
style="@style/ToolbarShadow"/>
</RelativeLayout>

View File

@@ -18,31 +18,34 @@
~ with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:habit="http://isoron.org/android"
android:id="@+id/llOuter"
style="@style/ListHabits.Item">
<merge android:id="@+id/outerFrame"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:habit="http://isoron.org/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/llInner"
style="@style/ListHabits.HabitCard">
android:id="@+id/innerFrame"
style="@style/ListHabits.HabitCard"
android:layout_width="match_parent">
<org.isoron.uhabits.views.RingView
android:layout_height="15dp"
android:layout_width="15dp"
android:id="@+id/scoreRing"
habit:thickness="3"
android:layout_marginTop="0dp"
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="8dp"/>
android:layout_marginTop="0dp"
habit:thickness="3"/>
<TextView
android:id="@+id/label"
style="@style/ListHabits.Label" />
style="@style/ListHabits.Label"/>
<org.isoron.uhabits.ui.habits.list.views.CheckmarkPanelView
android:id="@+id/checkmarkPanel"
style="@style/ListHabits.CheckmarkPanel"/>
<LinearLayout
android:id="@+id/llButtons"
style="@style/ListHabits.CheckmarkPanel" />
</LinearLayout>
</LinearLayout>
</merge>

View File

@@ -0,0 +1,46 @@
<?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
android:id="@+id/llHint"
style="@style/Card"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:animateLayoutChanges="true"
android:background="@color/indigo_500"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hint_title"
android:textColor="@color/white"
android:textStyle="bold"/>
<TextView
android:id="@+id/hintContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:textColor="@color/white"/>
</LinearLayout>

View File

@@ -0,0 +1,123 @@
<?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/>.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?windowBackgroundColor">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
style="@style/Toolbar"
app:popupTheme="?toolbarPopupTheme"
android:layout_alignParentTop="true"/>
<org.isoron.uhabits.ui.habits.list.views.HeaderView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/toolbar"
android:id="@+id/header"
style="@style/ListHabits.Header"/>
<LinearLayout
android:id="@+id/listView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?windowBackgroundColor"
android:divider="?windowBackgroundColor"
android:dividerHeight="1dp"
android:listSelector="@android:color/transparent"
android:layout_below="@id/header"
android:orientation="vertical">
<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"-->
<!--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" />-->
</LinearLayout>
<LinearLayout
android:id="@+id/llEmpty"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:visibility="gone">
<TextView
android:id="@+id/tvStarEmpty"
style="@style/ListHabits.EmptyState"
android:text="@string/fa_star_half_o"
android:textSize="80sp"/>
<TextView
style="@style/ListHabits.EmptyState"
android:text="@string/no_habits_found"/>
</LinearLayout>
<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/header"
android:layout_marginTop="@dimen/progressbarOffset"
android:visibility="gone"
/>
<org.isoron.uhabits.ui.habits.list.views.HintView
android:id="@+id/hintView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"/>
<View
android:id="@+id/toolbarShadow"
android:layout_below="@id/toolbar"
style="@style/ToolbarShadow"/>
</RelativeLayout>

View File

@@ -1,39 +0,0 @@
<!--
~ 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/>.
-->
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".MainActivity">
<item
android:id="@+id/action_add"
android:icon="?iconAdd"
android:title="@string/add_habit"
app:showAsAction="ifRoom"/>
<item
android:id="@+id/action_show_archived"
android:checkable="true"
android:enabled="true"
android:title="@string/show_archived"
android:orderInCategory="0"
app:showAsAction="never"/>
</menu>

View File

@@ -22,6 +22,20 @@
xmlns:tools="http://schemas.android.com/tools"
tools:context=".MainActivity">
<item
android:id="@+id/action_add"
android:icon="?iconAdd"
android:title="@string/add_habit"
app:showAsAction="ifRoom"/>
<item
android:id="@+id/action_show_archived"
android:checkable="true"
android:enabled="true"
android:title="@string/show_archived"
android:orderInCategory="0"
app:showAsAction="never"/>
<item
android:id="@+id/action_night_mode"
android:checkable="true"

View File

@@ -23,9 +23,7 @@
<style name="ListHabits.Header">
<item name="android:background">?headerBackgroundColor</item>
<item name="android:elevation">2dp</item>
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_alignParentTop">true</item>
<item name="android:paddingRight">4dp</item>
<item name="android:gravity">end</item>
</style>
</resources>

View File

@@ -240,7 +240,6 @@
<item name="android:layout_height">?actionBarSize</item>
<item name="android:background">?colorPrimary</item>
<item name="android:theme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item>
<item name="android:layout_alignParentTop">true</item>
</style>
<style name="Preference.Category.Material">
@@ -252,6 +251,5 @@
<item name="android:layout_height">2dp</item>
<item name="android:background">@drawable/toolbar_shadow</item>
<item name="android:alpha">0.2</item>
<item name="android:layout_below">@id/toolbar</item>
</style>
</resources>

View File

@@ -26,9 +26,6 @@
<style name="ListHabits.Header">
<item name="android:background">?headerBackground</item>
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_alignParentTop">true</item>
<item name="android:paddingRight">4dp</item>
</style>