mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-14 04:58:52 -06:00
Adding Habitgroup to type selection screen
This commit is contained in:
@@ -51,6 +51,12 @@ class HabitTypeDialog : AppCompatDialogFragment() {
|
||||
dismiss()
|
||||
}
|
||||
|
||||
binding.buttonHabitGroup.setOnClickListener {
|
||||
val intent = IntentFactory().startEditGroupActivity(requireActivity())
|
||||
startActivity(intent)
|
||||
dismiss()
|
||||
}
|
||||
|
||||
binding.background.setOnClickListener {
|
||||
dismiss()
|
||||
}
|
||||
|
||||
@@ -0,0 +1,163 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/contrast0"
|
||||
android:fitsSystemWindows="true"
|
||||
android:orientation="vertical"
|
||||
tools:context=".activities.habits.edit.EditHabitGroupActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/colorPrimary"
|
||||
android:elevation="2dp"
|
||||
android:gravity="end"
|
||||
android:minHeight="?attr/actionBarSize"
|
||||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
|
||||
app:title="@string/create_habit_group"
|
||||
app:titleTextColor="@color/white">
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/buttonSave"
|
||||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:text="@string/save"
|
||||
android:textColor="@color/white"
|
||||
app:rippleColor="@color/white"
|
||||
app:strokeColor="@color/white" />
|
||||
</androidx.appcompat.widget.Toolbar>
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingLeft="4dp"
|
||||
android:paddingRight="4dp">
|
||||
|
||||
<!-- Title and color -->
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:baselineAligned="false">
|
||||
|
||||
<!-- Habit Title -->
|
||||
<FrameLayout
|
||||
style="@style/FormOuterBox"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1">
|
||||
<LinearLayout style="@style/FormInnerBox">
|
||||
<TextView
|
||||
style="@style/FormLabel"
|
||||
android:text="@string/name" />
|
||||
<EditText
|
||||
android:id="@+id/nameInput"
|
||||
style="@style/FormInput"
|
||||
android:maxLines="1"
|
||||
android:inputType="textCapSentences"
|
||||
android:hint="@string/yes_or_no_short_example"
|
||||
/>
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
|
||||
<!-- Habit Color -->
|
||||
<FrameLayout
|
||||
style="@style/FormOuterBox"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="match_parent">
|
||||
<LinearLayout style="@style/FormInnerBox">
|
||||
<TextView
|
||||
style="@style/FormLabel"
|
||||
android:text="@string/color" />
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/colorButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:backgroundTint="#E23673" />
|
||||
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Habit Question -->
|
||||
<FrameLayout style="@style/FormOuterBox">
|
||||
<LinearLayout style="@style/FormInnerBox">
|
||||
<TextView
|
||||
style="@style/FormLabel"
|
||||
android:text="@string/question" />
|
||||
<EditText
|
||||
android:id="@+id/questionInput"
|
||||
style="@style/FormInput"
|
||||
android:inputType="textCapSentences|textMultiLine"
|
||||
android:hint="@string/example_question_boolean"
|
||||
/>
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
|
||||
<!-- Reminder -->
|
||||
<FrameLayout style="@style/FormOuterBox">
|
||||
<LinearLayout style="@style/FormInnerBox">
|
||||
<TextView
|
||||
style="@style/FormLabel"
|
||||
android:text="@string/reminder" />
|
||||
|
||||
<TextView
|
||||
style="@style/FormDropdown"
|
||||
android:id="@+id/reminderTimePicker"
|
||||
android:text="@string/reminder_off" />
|
||||
|
||||
<View
|
||||
style="@style/FormDivider"
|
||||
android:id="@+id/reminderDivider"/>
|
||||
|
||||
<TextView
|
||||
style="@style/FormDropdown"
|
||||
android:id="@+id/reminderDatePicker"
|
||||
android:text="" />
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<!-- Notes -->
|
||||
<FrameLayout style="@style/FormOuterBox">
|
||||
<LinearLayout style="@style/FormInnerBox">
|
||||
<TextView
|
||||
style="@style/FormLabel"
|
||||
android:text="@string/notes" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/notesInput"
|
||||
style="@style/FormInput"
|
||||
android:inputType="textCapSentences|textMultiLine"
|
||||
android:hint="@string/example_notes" />
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
@@ -67,6 +67,25 @@
|
||||
android:text="@string/measurable_example" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/buttonHabitGroup"
|
||||
style="@style/SelectHabitTypeButton">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SelectHabitTypeButtonTitle"
|
||||
android:text="@string/habit_group" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/SelectHabitTypeButtonBody"
|
||||
android:text="@string/habit_group_example" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- <LinearLayout-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
|
||||
@@ -64,6 +64,8 @@
|
||||
<string name="skip_days_off">Off</string>
|
||||
<string name="create_habit">Create habit</string>
|
||||
<string name="edit_habit">Edit habit</string>
|
||||
<string name="create_habit_group">Create habit group</string>
|
||||
<string name="edit_habit_group">Edit habit group</string>
|
||||
<string name="check">Check</string>
|
||||
<string name="snooze">Later</string>
|
||||
<string name="intro_title_1">Welcome</string>
|
||||
@@ -208,6 +210,8 @@
|
||||
<string name="yes_or_no_example">e.g. Did you wake up early today? Did you exercise? Did you play chess?</string>
|
||||
<string name="measurable">Measurable</string>
|
||||
<string name="measurable_example">e.g. How many miles did you run today? How many pages did you read?</string>
|
||||
<string name="habit_group">Habit Group</string>
|
||||
<string name="habit_group_example">A group to organize similar habits together. E.g. Exercise: Running, Cycling, Gym, etc.</string>
|
||||
<string name="x_times_per_week">%d times per week</string>
|
||||
<string name="x_times_per_month">%d times per month</string>
|
||||
<string name="x_times_per_y_days">%d times in %d days</string>
|
||||
|
||||
Reference in New Issue
Block a user