mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 01:08:50 -06:00
fully implementing question & description in UI and code
This commit is contained in:
@@ -187,6 +187,7 @@ public class EditHabitDialog extends AppCompatDialogFragment
|
||||
habit.copyFrom(originalHabit);
|
||||
habit.setName(namePanel.getName());
|
||||
habit.setDescription(namePanel.getDescription());
|
||||
habit.setQuestion(namePanel.getQuestion());
|
||||
habit.setColor(namePanel.getColor());
|
||||
habit.setReminder(reminderPanel.getReminder());
|
||||
habit.setFrequency(frequencyPanel.getFrequency());
|
||||
|
||||
@@ -24,6 +24,7 @@ import android.text.*;
|
||||
import android.util.*;
|
||||
import android.view.*;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.AppCompatEditText;
|
||||
|
||||
@@ -82,7 +83,7 @@ public class ExampleEditText extends AppCompatEditText
|
||||
updateText();
|
||||
}
|
||||
|
||||
public void setRealText(String realText)
|
||||
public void setRealText(@NonNull String realText)
|
||||
{
|
||||
this.realText = realText;
|
||||
updateText();
|
||||
|
||||
@@ -76,9 +76,14 @@ public class NameDescriptionPanel extends FrameLayout
|
||||
tvName.setTextColor(PaletteUtils.getColor(getContext(), color));
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Nullable
|
||||
public String getDescription()
|
||||
{
|
||||
return tvDescription.getRealText().trim();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public String getQuestion() {
|
||||
return tvQuestion.getRealText().trim();
|
||||
}
|
||||
|
||||
@@ -99,7 +104,11 @@ public class NameDescriptionPanel extends FrameLayout
|
||||
|
||||
setColor(habit.getColor());
|
||||
tvName.setText(habit.getName());
|
||||
tvQuestion.setRealText(habit.getDescription());
|
||||
tvQuestion.setRealText(habit.getQuestion());
|
||||
final String description = habit.getDescription();
|
||||
if(description != null) {
|
||||
tvDescription.setRealText(description);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean validate()
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
|
||||
<org.isoron.uhabits.activities.habits.edit.views.ExampleEditText
|
||||
android:id="@+id/tvQuestion"
|
||||
style="@style/dialogFormInputMultiline"
|
||||
style="@style/dialogFormInput"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:example="@string/example_question_numerical" />
|
||||
@@ -88,11 +88,10 @@
|
||||
|
||||
<org.isoron.uhabits.activities.habits.edit.views.ExampleEditText
|
||||
android:id="@+id/tvDescription"
|
||||
style="@style/dialogFormInput"
|
||||
style="@style/dialogFormInputMultiline"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="top"
|
||||
android:minHeight="300dp"
|
||||
app:example="@string/example_notes" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user