List edition activity redone with a RecyclerView

Lists are now editable and swappable
Lots of code simplification (TaskDialogFragment...)
This commit is contained in:
2015-12-30 19:02:27 -05:00
parent 27884add9e
commit c8dbcb1aff
26 changed files with 547 additions and 523 deletions

View File

@@ -1,83 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="16dp"
android:orientation="vertical"
tools:context=".activities.MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/new_task_list"
android:textAppearance="?android:attr/textAppearanceLarge" />
<Spinner
android:id="@+id/new_task_list"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</Spinner>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/new_task_name"
android:textAppearance="?android:attr/textAppearanceLarge" />
<EditText
android:id="@+id/new_task_name"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/new_task_description"
android:textAppearance="?android:attr/textAppearanceLarge" />
<EditText
android:id="@+id/new_task_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lines="3"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/new_task_priority"
android:textAppearance="?android:attr/textAppearanceLarge" />
<RadioGroup
android:id="@+id/new_task_priority"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RadioButton
android:id="@+id/new_task_priority_low"
android:text="@string/new_task_priority_low"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</RadioButton>
<RadioButton
android:id="@+id/new_task_priority_normal"
android:text="@string/new_task_priority_normal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:checked="true">
</RadioButton>
<RadioButton
android:id="@+id/new_task_priority_high"
android:text="@string/new_task_priority_high"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</RadioButton>
</RadioGroup>
<LinearLayout
android:padding="20dp"
android:layout_width="match_parent"
android:layout_height="40dp"
android:orientation="horizontal" >
<Button
android:id="@+id/new_task_save"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="@string/new_task_save" />
<Button
android:id="@+id/new_task_cancel"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="@string/new_task_cancel"/>
</LinearLayout>
</LinearLayout>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".activities.TaskListActivity">
<fragment
android:name="com.wismna.geoffroy.donext.fragments.TaskListsFragment"
android:id="@+id/fragment_task_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout="@layout/fragment_tasklists" />
</LinearLayout>

View File

@@ -1,29 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:padding="6dip">
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:foreground="?selectableItemBackground" >
<TextView
android:id="@+id/task_list_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="test"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:padding="10dp"
android:textAppearance="?android:attr/textAppearanceMedium"/>
<TextView
<EditText
android:id="@+id/task_list_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_toRightOf="@id/task_list_count"
android:layout_centerVertical="true"
android:text="Name"
android:layout_toEndOf="@id/task_list_count"
android:inputType="text"
android:textAppearance="?android:attr/textAppearanceLarge"/>
<Button
android:id="@+id/task_list_delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:padding="10dp"
android:text="@string/task_list_delete"
android:onClick="onDeleteTaskList" />
</RelativeLayout>
</RelativeLayout>

View File

@@ -23,12 +23,22 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:onClick="onCreateTaskList"
android:layout_alignParentEnd="true"
android:text="@string/task_list_new_list_create"/>
</RelativeLayout>
<ListView
android:id="@android:id/list"
<android.support.v7.widget.RecyclerView
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:id="@+id/task_lists_view"
android:name="com.wismna.geoffroy.donext.fragments.TaskListFragment"
android:layout_width="match_parent"
android:layout_height="match_parent">
</ListView>
android:layout_height="match_parent"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
app:layoutManager="LinearLayoutManager"
tools:context=".fragments.TaskListsFragment"
tools:listitem="@layout/fragment_tasklist" />
</LinearLayout>

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/task_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>

View File

@@ -6,9 +6,7 @@
<string name="action_editTabs">Edit lists</string>
<string name="action_about">About</string>
<string name="action_new_task">New task</string>
<string name="section_format">Hello World from section: %1$d</string>
<string name="settings_activity_title">Settings</string>
<string name="task_list_activity_title">List edition</string>
<!-- Strings related to Task List edition -->
<string name="task_list_new_list_hint">New list name</string>