fix: habits with long description could not be saved

- That was due to a bug where the dialog was not resized
    or scrollable and therefore the save button was not
    accessible

References: #462
pull/472/head
Christoph Hennemann 7 years ago
parent 178061475e
commit b180f11834

@ -19,6 +19,7 @@
package org.isoron.uhabits.activities.habits.edit; package org.isoron.uhabits.activities.habits.edit;
import android.app.Dialog;
import android.content.*; import android.content.*;
import android.os.*; import android.os.*;
import android.support.annotation.*; import android.support.annotation.*;
@ -117,6 +118,17 @@ public class EditHabitDialog extends AppCompatDialogFragment
return view; return view;
} }
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final Dialog dialog = super.onCreateDialog(savedInstanceState);
final Window window = dialog.getWindow();
if (window != null) {
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
}
return dialog;
}
protected int getTitle() protected int getTitle()
{ {
if (originalHabit != null) return R.string.edit_habit; if (originalHabit != null) return R.string.edit_habit;

@ -17,62 +17,66 @@
~ with this program. If not, see <http://www.gnu.org/licenses/>. ~ with this program. If not, see <http://www.gnu.org/licenses/>.
--> -->
<LinearLayout <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/container"
style="@style/dialogForm"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
tools:context=".activities.habits.edit.EditHabitDialog" android:layout_width="wrap_content"
tools:ignore="MergeRootFrame"> android:layout_height="wrap_content">
<LinearLayout <LinearLayout
android:id="@+id/formPanel" android:id="@+id/container"
style="@style/dialogFormPanel"> style="@style/dialogForm"
tools:context=".activities.habits.edit.EditHabitDialog"
tools:ignore="MergeRootFrame">
<org.isoron.uhabits.activities.habits.edit.views.NameDescriptionPanel <LinearLayout
android:id="@+id/namePanel" android:id="@+id/formPanel"
android:layout_width="match_parent" style="@style/dialogFormPanel">
android:layout_height="wrap_content"/>
<org.isoron.uhabits.activities.habits.edit.views.FrequencyPanel <org.isoron.uhabits.activities.habits.edit.views.NameDescriptionPanel
android:id="@+id/frequencyPanel" android:id="@+id/namePanel"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"/> android:layout_height="wrap_content" />
<org.isoron.uhabits.activities.habits.edit.views.TargetPanel <org.isoron.uhabits.activities.habits.edit.views.FrequencyPanel
android:id="@+id/targetPanel" android:id="@+id/frequencyPanel"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"/> android:layout_height="wrap_content" />
<org.isoron.uhabits.activities.habits.edit.views.ReminderPanel <org.isoron.uhabits.activities.habits.edit.views.TargetPanel
android:id="@+id/reminderPanel" android:id="@+id/targetPanel"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"/> android:layout_height="wrap_content" />
</LinearLayout> <org.isoron.uhabits.activities.habits.edit.views.ReminderPanel
android:id="@+id/reminderPanel"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout </LinearLayout>
style="?android:attr/buttonBarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="end"
android:paddingEnd="16dp"
android:paddingLeft="0dp"
android:paddingRight="16dp"
android:paddingStart="0dp">
<Button <LinearLayout
android:id="@+id/buttonDiscard" style="?android:attr/buttonBarStyle"
style="?android:attr/buttonBarButtonStyle" android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/discard"/> android:gravity="end"
android:paddingStart="0dp"
android:paddingLeft="0dp"
android:paddingEnd="16dp"
android:paddingRight="16dp">
<Button <Button
android:id="@+id/buttonSave" android:id="@+id/buttonDiscard"
style="?android:attr/buttonBarButtonStyle" style="?android:attr/buttonBarButtonStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/save"/> android:text="@string/discard" />
<Button
android:id="@+id/buttonSave"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/save" />
</LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </ScrollView>
Loading…
Cancel
Save