Skip to content

Commit 1e13028

Browse files
Merge pull request #254 from Ayush0Chaudhary/fix/keyboard-hiding-edittext
Fix: Keyboard hides instruction EditText in CreateTriggerActivity
2 parents 0af1d99 + 6346072 commit 1e13028

File tree

3 files changed

+32
-19
lines changed

3 files changed

+32
-19
lines changed

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
</activity>
7575

7676
<activity android:name=".triggers.ui.TriggersActivity" android:exported="false" android:label="Triggers" android:theme="@style/Theme.Blurr" />
77-
<activity android:name=".triggers.ui.CreateTriggerActivity" android:exported="false" android:label="Create Trigger" android:theme="@style/Theme.Blurr" />
77+
<activity android:name=".triggers.ui.CreateTriggerActivity" android:exported="false" android:label="Create Trigger" android:theme="@style/Theme.Blurr" android:windowSoftInputMode="adjustResize" />
7878
<activity android:name=".triggers.ui.ChooseTriggerTypeActivity" android:exported="false" android:label="Choose Trigger Type" android:theme="@style/Theme.Blurr" />
7979

8080

app/src/main/java/com/blurr/voice/triggers/ui/CreateTriggerActivity.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import android.widget.Button
77
import android.widget.EditText
88
import android.widget.LinearLayout
99
import android.widget.RadioGroup
10+
import android.widget.ScrollView
1011
import android.widget.TimePicker
1112
import android.widget.Toast
1213
import androidx.appcompat.app.AppCompatActivity
@@ -31,6 +32,7 @@ class CreateTriggerActivity : AppCompatActivity() {
3132
private lateinit var appsRecyclerView: RecyclerView
3233
private lateinit var dayOfWeekChipGroup: com.google.android.material.chip.ChipGroup
3334
private lateinit var appAdapter: AppAdapter
35+
private lateinit var scrollView: ScrollView
3436

3537
private var selectedTriggerType = TriggerType.SCHEDULED_TIME
3638
private var selectedApp: AppInfo? = null
@@ -50,6 +52,16 @@ class CreateTriggerActivity : AppCompatActivity() {
5052
timePicker = findViewById(R.id.timePicker)
5153
appsRecyclerView = findViewById(R.id.appsRecyclerView)
5254
dayOfWeekChipGroup = findViewById(R.id.dayOfWeekChipGroup)
55+
// scrollView = findViewById(R.id.scrollView)
56+
57+
// instructionEditText.setOnFocusChangeListener { view, hasFocus ->
58+
// if (hasFocus) {
59+
// // Delay scrolling until the keyboard is likely to be visible
60+
// view.postDelayed({
61+
// scrollView.smoothScrollTo(0, view.bottom)
62+
// }, 200)
63+
// }
64+
// }
5365

5466
// Set default checked state for all day chips
5567
for (i in 0 until dayOfWeekChipGroup.childCount) {

app/src/main/res/layout/activity_create_trigger.xml

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
app:titleTextColor="@color/white" />
1717

1818
<ScrollView
19+
android:id="@+id/scrollView"
1920
android:layout_width="match_parent"
2021
android:layout_height="match_parent"
2122
android:layout_below="@id/toolbar"
@@ -43,6 +44,24 @@
4344
android:layout_height="wrap_content"
4445
android:theme="@style/AppTheme.NumberPicker"
4546
android:timePickerMode="spinner" />
47+
<TextView
48+
style="@style/PermissionHeading"
49+
android:text="Task Instruction" />
50+
51+
<EditText
52+
android:id="@+id/instructionEditText"
53+
android:layout_width="match_parent"
54+
android:layout_height="wrap_content"
55+
android:background="@drawable/edit_text_border"
56+
android:hint="e.g., 'Read the notification'"
57+
android:inputType="textMultiLine"
58+
android:minLines="2"
59+
android:maxLines="5"
60+
android:scrollbars="vertical"
61+
android:gravity="top"
62+
android:padding="12dp"
63+
android:textColor="@color/white"
64+
android:textColorHint="#8A8A8E" />
4665

4766
<TextView
4867
style="@style/PermissionHeading"
@@ -84,24 +103,6 @@
84103
tools:listitem="@layout/item_app" />
85104
</LinearLayout>
86105

87-
<TextView
88-
style="@style/PermissionHeading"
89-
android:text="Task Instruction" />
90-
91-
<EditText
92-
android:id="@+id/instructionEditText"
93-
android:layout_width="match_parent"
94-
android:layout_height="wrap_content"
95-
android:background="@drawable/edit_text_border"
96-
android:hint="e.g., 'Read the notification'"
97-
android:inputType="textMultiLine"
98-
android:minLines="2"
99-
android:maxLines="5"
100-
android:scrollbars="vertical"
101-
android:gravity="top"
102-
android:padding="12dp"
103-
android:textColor="@color/white"
104-
android:textColorHint="#8A8A8E" />
105106

106107
<Button
107108
android:id="@+id/saveTriggerButton"

0 commit comments

Comments
 (0)