mirror of
https://github.com/wismna/DoNext.git
synced 2025-10-03 07:30:13 -04:00
Corrected bug in DialogFragments where button count was badly implemented
New content task form layout for Android 19
This commit is contained in:
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -24,7 +24,7 @@
|
|||||||
</value>
|
</value>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectType">
|
<component name="ProjectType">
|
||||||
|
@@ -104,8 +104,6 @@ public class TaskDataAccess implements AutoCloseable {
|
|||||||
task.setName(cursor.getString(1));
|
task.setName(cursor.getString(1));
|
||||||
task.setTodayDate(cursor.getString(2));
|
task.setTodayDate(cursor.getString(2));
|
||||||
task.setTaskListName(cursor.getString(3));
|
task.setTaskListName(cursor.getString(3));
|
||||||
task.setDone(cursor.getInt(5));
|
|
||||||
task.setDeleted(cursor.getInt(6));
|
|
||||||
tasks.add(task);
|
tasks.add(task);
|
||||||
cursor.moveToNext();
|
cursor.moveToNext();
|
||||||
}
|
}
|
||||||
|
@@ -111,20 +111,31 @@ public abstract class DynamicDialogFragment extends DialogFragment {
|
|||||||
public void onPrepareOptionsMenu(Menu menu) {
|
public void onPrepareOptionsMenu(Menu menu) {
|
||||||
Bundle args = getArguments();
|
Bundle args = getArguments();
|
||||||
assert args != null;
|
assert args != null;
|
||||||
// Show the neutral button if needed
|
/*switch (mButtonCount) {
|
||||||
if (mButtonCount == 2) {
|
case 1:
|
||||||
menu.removeItem(R.id.menu_neutral_button);
|
menu.removeItem(R.id.menu_positive_button);
|
||||||
}
|
menu.removeItem(R.id.menu_neutral_button);
|
||||||
else {
|
break;
|
||||||
menu.findItem(R.id.menu_neutral_button).setTitle(args.getString("button_neutral"));
|
case 2:
|
||||||
|
menu.removeItem(R.id.menu_neutral_button);
|
||||||
|
menu.findItem(R.id.menu_positive_button).setTitle(args.getString("button_positive"));
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
menu.findItem(R.id.menu_neutral_button).setTitle(args.getString("button_neutral"));
|
||||||
|
menu.findItem(R.id.menu_positive_button).setTitle(args.getString("button_positive"));
|
||||||
|
break;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
// Hide buttons depending on count
|
||||||
|
switch (mButtonCount) {
|
||||||
|
case 1: menu.removeItem(R.id.menu_positive_button);
|
||||||
|
case 2: menu.removeItem(R.id.menu_neutral_button);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show the positive button if needed
|
// Set titles on existing buttons
|
||||||
if (mButtonCount == 1) {
|
switch (mButtonCount) {
|
||||||
menu.removeItem(R.id.menu_positive_button);
|
case 3: menu.findItem(R.id.menu_neutral_button).setTitle(args.getString("button_neutral"));
|
||||||
}
|
case 2: menu.findItem(R.id.menu_positive_button).setTitle(args.getString("button_positive"));
|
||||||
else {
|
|
||||||
menu.findItem(R.id.menu_positive_button).setTitle(args.getString("button_positive"));
|
|
||||||
}
|
}
|
||||||
super.onPrepareOptionsMenu(menu);
|
super.onPrepareOptionsMenu(menu);
|
||||||
}
|
}
|
||||||
|
120
app/src/main/res/layout-v21/content_task_form.xml
Normal file
120
app/src/main/res/layout-v21/content_task_form.xml
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<ScrollView
|
||||||
|
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:background="@android:color/background_light">
|
||||||
|
<com.wismna.geoffroy.donext.widgets.InterceptTouchRelativeLayout
|
||||||
|
android:id="@+id/new_task_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="@dimen/text_margin"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:focusable="true"
|
||||||
|
android:focusableInTouchMode="true"
|
||||||
|
tools:context=".activities.MainActivity">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/new_task_list_label"
|
||||||
|
android:text="@string/new_task_list"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:layout_marginTop="3dp"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
<Spinner
|
||||||
|
android:id="@+id/new_task_list"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="5dp"
|
||||||
|
android:layout_toEndOf="@id/new_task_list_label">
|
||||||
|
</Spinner>
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/new_task_name"
|
||||||
|
android:hint="@string/new_task_name_hint"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:inputType="text"
|
||||||
|
android:textSize="30sp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/new_task_list"
|
||||||
|
android:imeOptions="flagNoFullscreen"/>
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/new_task_description"
|
||||||
|
android:hint="@string/new_task_description_hint"
|
||||||
|
android:gravity="top|start"
|
||||||
|
android:lines="3"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/new_task_name"
|
||||||
|
android:imeOptions="flagNoFullscreen" />
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/new_task_priority_label"
|
||||||
|
android:text="@string/new_task_priority"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="4dp"
|
||||||
|
android:layout_below="@id/new_task_description" />
|
||||||
|
<SeekBar
|
||||||
|
android:id="@+id/new_task_priority"
|
||||||
|
android:max="2"
|
||||||
|
android:progress="1"
|
||||||
|
android:layout_width="300dp"
|
||||||
|
android:layout_height="30dp"
|
||||||
|
android:layout_toEndOf="@id/new_task_priority_label"
|
||||||
|
android:layout_below="@id/new_task_description" />
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/new_task_priority_tooltip"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:layout_above="@id/new_task_priority"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:background="@android:color/darker_gray"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:visibility="gone" />
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/new_task_today"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="visible"
|
||||||
|
android:layout_below="@id/new_task_priority"
|
||||||
|
android:layout_alignParentEnd="true" />
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/new_task_today_label"
|
||||||
|
android:text="@string/new_task_today"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:visibility="visible"
|
||||||
|
android:layout_below="@id/new_task_priority" />
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/new_task_due_date_set"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/new_task_today"
|
||||||
|
android:layout_alignParentEnd="true" />
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/new_task_due_date_label"
|
||||||
|
android:text="@string/new_task_due_date"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_below="@id/new_task_today" />
|
||||||
|
<DatePicker
|
||||||
|
android:id="@+id/new_task_due_date"
|
||||||
|
android:datePickerMode="spinner"
|
||||||
|
android:calendarViewShown="false"
|
||||||
|
android:spinnersShown="true"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/new_task_due_date_label" />
|
||||||
|
</com.wismna.geoffroy.donext.widgets.InterceptTouchRelativeLayout>
|
||||||
|
</ScrollView>
|
@@ -109,7 +109,6 @@
|
|||||||
android:layout_below="@id/new_task_today" />
|
android:layout_below="@id/new_task_today" />
|
||||||
<DatePicker
|
<DatePicker
|
||||||
android:id="@+id/new_task_due_date"
|
android:id="@+id/new_task_due_date"
|
||||||
android:datePickerMode="spinner"
|
|
||||||
android:calendarViewShown="false"
|
android:calendarViewShown="false"
|
||||||
android:spinnersShown="true"
|
android:spinnersShown="true"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
|
Reference in New Issue
Block a user