mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 17:18:52 -06:00
edit name description panel xml
This commit is contained in:
@@ -87,6 +87,7 @@ dependencies {
|
|||||||
implementation "com.google.code.gson:gson:2.8.5"
|
implementation "com.google.code.gson:gson:2.8.5"
|
||||||
implementation "com.google.code.findbugs:jsr305:3.0.2"
|
implementation "com.google.code.findbugs:jsr305:3.0.2"
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$KOTLIN_VERSION"
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$KOTLIN_VERSION"
|
||||||
|
implementation "androidx.constraintlayout:constraintlayout:2.0.0-beta4"
|
||||||
|
|
||||||
compileOnly "javax.annotation:jsr250-api:1.0"
|
compileOnly "javax.annotation:jsr250-api:1.0"
|
||||||
compileOnly "com.google.auto.factory:auto-factory:$AUTO_FACTORY_VERSION"
|
compileOnly "com.google.auto.factory:auto-factory:$AUTO_FACTORY_VERSION"
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import androidx.annotation.StringRes;
|
|||||||
import androidx.test.espresso.*;
|
import androidx.test.espresso.*;
|
||||||
import androidx.test.espresso.contrib.*;
|
import androidx.test.espresso.contrib.*;
|
||||||
import androidx.test.uiautomator.*;
|
import androidx.test.uiautomator.*;
|
||||||
import androidx.appcompat.widget.*;
|
|
||||||
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
@@ -167,7 +166,7 @@ public class CommonSteps extends BaseUserInterfaceTest
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case EDIT_HABIT:
|
case EDIT_HABIT:
|
||||||
onView(withId(R.id.tvDescription)).check(matches(isDisplayed()));
|
onView(withId(R.id.tvQuestion)).check(matches(isDisplayed()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public class EditHabitSteps
|
|||||||
|
|
||||||
public static void typeQuestion(String name)
|
public static void typeQuestion(String name)
|
||||||
{
|
{
|
||||||
typeTextWithId(R.id.tvDescription, name);
|
typeTextWithId(R.id.tvQuestion, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setReminder()
|
public static void setReminder()
|
||||||
|
|||||||
@@ -42,6 +42,9 @@ public class NameDescriptionPanel extends FrameLayout
|
|||||||
@BindView(R.id.tvName)
|
@BindView(R.id.tvName)
|
||||||
EditText tvName;
|
EditText tvName;
|
||||||
|
|
||||||
|
@BindView(R.id.tvQuestion)
|
||||||
|
ExampleEditText tvQuestion;
|
||||||
|
|
||||||
@BindView(R.id.tvDescription)
|
@BindView(R.id.tvDescription)
|
||||||
ExampleEditText tvDescription;
|
ExampleEditText tvDescription;
|
||||||
|
|
||||||
@@ -76,7 +79,7 @@ public class NameDescriptionPanel extends FrameLayout
|
|||||||
@NonNull
|
@NonNull
|
||||||
public String getDescription()
|
public String getDescription()
|
||||||
{
|
{
|
||||||
return tvDescription.getRealText().trim();
|
return tvQuestion.getRealText().trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@@ -90,13 +93,13 @@ public class NameDescriptionPanel extends FrameLayout
|
|||||||
Resources res = getResources();
|
Resources res = getResources();
|
||||||
|
|
||||||
if(habit.isNumerical())
|
if(habit.isNumerical())
|
||||||
tvDescription.setExample(res.getString(R.string.example_question_numerical));
|
tvQuestion.setExample(res.getString(R.string.example_question_numerical));
|
||||||
else
|
else
|
||||||
tvDescription.setExample(res.getString(R.string.example_question_boolean));
|
tvQuestion.setExample(res.getString(R.string.example_question_boolean));
|
||||||
|
|
||||||
setColor(habit.getColor());
|
setColor(habit.getColor());
|
||||||
tvName.setText(habit.getName());
|
tvName.setText(habit.getName());
|
||||||
tvDescription.setRealText(habit.getDescription());
|
tvQuestion.setRealText(habit.getDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean validate()
|
public boolean validate()
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ class AndroidNotificationTray
|
|||||||
val builder = NotificationCompat.Builder(context, REMINDERS_CHANNEL_ID)
|
val builder = NotificationCompat.Builder(context, REMINDERS_CHANNEL_ID)
|
||||||
.setSmallIcon(R.drawable.ic_notification)
|
.setSmallIcon(R.drawable.ic_notification)
|
||||||
.setContentTitle(habit.name)
|
.setContentTitle(habit.name)
|
||||||
.setContentText(if(habit.description.isBlank()) defaultText else habit.description)
|
.setContentText(if(habit.description.isNullOrBlank()) defaultText else habit.description)
|
||||||
.setContentIntent(pendingIntents.showHabit(habit))
|
.setContentIntent(pendingIntents.showHabit(habit))
|
||||||
.setDeleteIntent(pendingIntents.dismissNotification(habit))
|
.setDeleteIntent(pendingIntents.dismissNotification(habit))
|
||||||
.addAction(addRepetitionAction)
|
.addAction(addRepetitionAction)
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
<!--
|
|
||||||
~ Copyright (C) 2016 Álinson Santos Xavier <isoron@gmail.com>
|
~ Copyright (C) 2016 Álinson Santos Xavier <isoron@gmail.com>
|
||||||
~
|
~
|
||||||
~ This file is part of Loop Habit Tracker.
|
~ This file is part of Loop Habit Tracker.
|
||||||
@@ -18,53 +17,83 @@
|
|||||||
~ with this program. If not, see <http://www.gnu.org/licenses/>.
|
~ with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<LinearLayout
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://isoron.org/android"
|
xmlns:app="http://isoron.org/android"
|
||||||
|
xmlns:app1="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:minWidth="300dp">
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
style="@style/dialogFormRow">
|
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
|
||||||
android:id="@+id/tilName"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="6">
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/tvName"
|
|
||||||
style="@style/dialogFormInput"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:hint="@string/name">
|
|
||||||
|
|
||||||
<requestFocus/>
|
|
||||||
</EditText>
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
|
||||||
|
|
||||||
<ImageButton
|
|
||||||
android:id="@+id/buttonPickColor"
|
|
||||||
style="@style/dialogFormInputColor"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:contentDescription="@string/color_picker_default_title"
|
|
||||||
android:src="?dialogIconChangeColor"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
android:layout_width="match_parent"
|
android:id="@+id/tilName"
|
||||||
android:layout_height="wrap_content">
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app1:layout_constraintEnd_toStartOf="@+id/buttonPickColor"
|
||||||
|
app1:layout_constraintHorizontal_weight="6"
|
||||||
|
app1:layout_constraintStart_toStartOf="parent"
|
||||||
|
app1:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/tvName"
|
||||||
|
style="@style/dialogFormInput"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:ellipsize="start"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:hint="@string/name">
|
||||||
|
|
||||||
|
<requestFocus />
|
||||||
|
</EditText>
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/buttonPickColor"
|
||||||
|
style="@style/dialogFormInputColor"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:contentDescription="@string/color_picker_default_title"
|
||||||
|
android:src="?dialogIconChangeColor"
|
||||||
|
app1:layout_constraintBottom_toBottomOf="@id/tilName"
|
||||||
|
app1:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app1:layout_constraintHorizontal_weight="1"
|
||||||
|
app1:layout_constraintStart_toEndOf="@+id/tilName"
|
||||||
|
app1:layout_constraintTop_toTopOf="@id/tilName" />
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
android:id="@+id/tilQuestion"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:hint="@string/question"
|
||||||
|
app1:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app1:layout_constraintStart_toStartOf="parent"
|
||||||
|
app1:layout_constraintTop_toBottomOf="@id/tilName">
|
||||||
|
|
||||||
<org.isoron.uhabits.activities.habits.edit.views.ExampleEditText
|
<org.isoron.uhabits.activities.habits.edit.views.ExampleEditText
|
||||||
android:id="@+id/tvDescription"
|
android:id="@+id/tvQuestion"
|
||||||
style="@style/dialogFormInputMultiline"
|
style="@style/dialogFormInputMultiline"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:hint="@string/question"
|
app:example="@string/example_question_numerical" />
|
||||||
app:example="@string/example_question_numerical"/>
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:hint="@string/notes"
|
||||||
|
app1:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app1:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app1:layout_constraintStart_toStartOf="parent"
|
||||||
|
app1:layout_constraintTop_toBottomOf="@id/tilQuestion">
|
||||||
|
|
||||||
|
<org.isoron.uhabits.activities.habits.edit.views.ExampleEditText
|
||||||
|
android:id="@+id/tvDescription"
|
||||||
|
style="@style/dialogFormInput"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="top"
|
||||||
|
android:minHeight="300dp"
|
||||||
|
app:example="@string/example_notes" />
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -244,5 +244,7 @@
|
|||||||
<string name="widget_opacity_description">Makes widgets more transparent or more opaque in your home screen.</string>
|
<string name="widget_opacity_description">Makes widgets more transparent or more opaque in your home screen.</string>
|
||||||
<string name="first_day_of_the_week">First day of the week</string>
|
<string name="first_day_of_the_week">First day of the week</string>
|
||||||
<string name="default_reminder_question">Have you completed this habit today?</string>
|
<string name="default_reminder_question">Have you completed this habit today?</string>
|
||||||
|
<string name="notes">Notes</string>
|
||||||
|
<string name="example_notes">You can put whatever you want here!</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
Reference in New Issue
Block a user