Bug correction when saving a task in full screen mode

This commit is contained in:
2017-03-16 20:59:46 -04:00
parent 0fb7e37f93
commit 13d6af6896
5 changed files with 7 additions and 9 deletions

View File

@@ -5,7 +5,7 @@
<GradleProjectSettings> <GradleProjectSettings>
<option name="distributionType" value="LOCAL" /> <option name="distributionType" value="LOCAL" />
<option name="externalProjectPath" value="$PROJECT_DIR$" /> <option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="C:\Program Files\Android\Android Studio\gradle\gradle-2.14.1" /> <option name="gradleHome" value="$APPLICATION_HOME_DIR$/gradle/gradle-2.14.1" />
<option name="modules"> <option name="modules">
<set> <set>
<option value="$PROJECT_DIR$" /> <option value="$PROJECT_DIR$" />

2
DoNExt/.idea/misc.xml generated
View File

@@ -37,7 +37,7 @@
<ConfirmationsSetting value="0" id="Add" /> <ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" /> <ConfirmationsSetting value="0" id="Remove" />
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="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">

Binary file not shown.

View File

@@ -214,12 +214,11 @@ public class TaskDialogFragment extends DialogFragment {
int id = item.getItemId(); int id = item.getItemId();
if (id == R.id.menu_new_task_save) { if (id == R.id.menu_new_task_save) {
EditText titleText = (EditText) getDialog().findViewById(R.id.new_task_name); EditText titleText = (EditText) getView().findViewById(R.id.new_task_name);
// handle confirmation button click hereEditText titleText = (EditText) d.findViewById(R.id.new_task_name); // handle confirmation button click hereEditText titleText = (EditText) d.findViewById(R.id.new_task_name);
if (titleText.getText().toString().matches("")) if (titleText.getText().toString().matches(""))
titleText.setError(getResources().getString(R.string.new_task_name_error)); titleText.setError(getResources().getString(R.string.new_task_name_error));
else else {
{
// Send the positive button event back to the host activity // Send the positive button event back to the host activity
mListener.onNewTaskDialogPositiveClick(TaskDialogFragment.this); mListener.onNewTaskDialogPositiveClick(TaskDialogFragment.this);
dismiss(); dismiss();

View File

@@ -1,6 +1,5 @@
package com.wismna.geoffroy.donext.fragments; package com.wismna.geoffroy.donext.fragments;
import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.Resources; import android.content.res.Resources;
@@ -143,12 +142,11 @@ public class TasksFragment extends Fragment implements
taskDialogFragment.setArguments(args); taskDialogFragment.setArguments(args);
// Open the fragment as a dialog or as full-screen depending on screen size // Open the fragment as a dialog or as full-screen depending on screen size
FragmentManager fragmentManager = getFragmentManager();
if (mIsLargeLayout) if (mIsLargeLayout)
taskDialogFragment.show(manager, getResources().getString(R.string.action_edit_task)); taskDialogFragment.show(manager, getResources().getString(R.string.action_edit_task));
else { else {
// The device is smaller, so show the fragment fullscreen // The device is smaller, so show the fragment fullscreen
FragmentTransaction transaction = fragmentManager.beginTransaction(); FragmentTransaction transaction = manager.beginTransaction();
// For a little polish, specify a transition animation // For a little polish, specify a transition animation
transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
// To make it fullscreen, use the 'content' root view as the container // To make it fullscreen, use the 'content' root view as the container
@@ -319,7 +317,8 @@ public class TasksFragment extends Fragment implements
@Override @Override
public void onNewTaskDialogPositiveClick(DialogFragment dialog) { public void onNewTaskDialogPositiveClick(DialogFragment dialog) {
// Get the dialog fragment // Get the dialog fragment
Dialog dialogView = dialog.getDialog(); View dialogView = dialog.getView();
if (dialogView == null) return;
long id = 0; long id = 0;
Task task = ((TaskDialogFragment)dialog).getTask(); Task task = ((TaskDialogFragment)dialog).getTask();
if (task != null) id = task.getId(); if (task != null) id = task.getId();