Skip to content
This repository was archived by the owner on Jun 5, 2022. It is now read-only.

Commit aa9191c

Browse files
committed
Text input fields styling update
- Make sure all text input fields use the 'outlined box' style - Update autocomplete styling to new Material styles - Disable animation on text input fields in WatcherActivity initially, to prevent the hint labels moving up animation when data is initially loaded. Once there is a watcher (either loaded from server or a new local object), enable the animations again for the user.
1 parent 79ab08a commit aa9191c

File tree

7 files changed

+28
-9
lines changed

7 files changed

+28
-9
lines changed

app/src/main/java/nl/jpelgrm/movienotifier/ui/WatcherActivity.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,10 @@ private void updateViews(boolean cinemaOnly) {
475475
binding.watcherName.setText(watcher.getName());
476476
binding.watcherMovieID.setText(watcher.getMovieID() == null ? "" : String.valueOf(watcher.getMovieID()));
477477

478+
if(!binding.watcherNameWrapper.isHintAnimationEnabled()) { binding.watcherNameWrapper.setHintAnimationEnabled(true); }
479+
if(!binding.watcherMovieIDWrapper.isHintAnimationEnabled()) { binding.watcherMovieIDWrapper.setHintAnimationEnabled(true); }
480+
if(!binding.watcherCinemaIDWrapper.isHintAnimationEnabled()) { binding.watcherCinemaIDWrapper.setHintAnimationEnabled(true); }
481+
478482
binding.autocompleteSuggestion.setVisibility((mode == Mode.EDITING && settings.getInt("prefAutocompleteLocation", -1) == -1) ? View.VISIBLE : View.GONE);
479483

480484
DateFormat format = SimpleDateFormat.getDateTimeInstance(java.text.DateFormat.MEDIUM, java.text.DateFormat.SHORT);

app/src/main/java/nl/jpelgrm/movienotifier/ui/view/InstantAutoComplete.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22

33
import android.content.Context;
44
import android.graphics.Rect;
5-
import androidx.appcompat.widget.AppCompatAutoCompleteTextView;
65
import android.util.AttributeSet;
76

7+
import com.google.android.material.textview.MaterialAutoCompleteTextView;
8+
89
// Based on https://stackoverflow.com/a/5783983
9-
public class InstantAutoComplete extends AppCompatAutoCompleteTextView {
10+
public class InstantAutoComplete extends MaterialAutoCompleteTextView {
1011

1112
public InstantAutoComplete(Context context) {
1213
super(context);

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,12 @@
9090

9191
<com.google.android.material.textfield.TextInputLayout
9292
android:id="@+id/watcherNameWrapper"
93+
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
9394
android:layout_width="match_parent"
9495
android:layout_height="wrap_content"
9596
android:gravity="center_vertical"
96-
android:layout_toEndOf="@+id/watcherNameIcon">
97+
android:layout_toEndOf="@+id/watcherNameIcon"
98+
app:hintAnimationEnabled="false">
9799

98100
<androidx.emoji.widget.EmojiAppCompatEditText
99101
android:id="@+id/watcherName"
@@ -131,10 +133,12 @@
131133

132134
<com.google.android.material.textfield.TextInputLayout
133135
android:id="@+id/watcherMovieIDWrapper"
136+
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
134137
android:layout_width="match_parent"
135138
android:layout_height="wrap_content"
136139
android:gravity="center_vertical"
137-
android:layout_toEndOf="@id/watcherMovieIDIcon">
140+
android:layout_toEndOf="@id/watcherMovieIDIcon"
141+
app:hintAnimationEnabled="false">
138142

139143
<androidx.appcompat.widget.AppCompatEditText
140144
android:id="@+id/watcherMovieID"
@@ -177,6 +181,7 @@
177181
android:layout_height="wrap_content"
178182
android:gravity="center_vertical"
179183
android:layout_toEndOf="@+id/watcherCinemaIDIcon"
184+
app:hintAnimationEnabled="false"
180185
app:endIconMode="none">
181186

182187
<nl.jpelgrm.movienotifier.ui.view.InstantAutoComplete

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060

6161
<com.google.android.material.textfield.TextInputLayout
6262
android:id="@+id/nameWrapper"
63+
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
6364
android:layout_width="match_parent"
6465
android:layout_height="wrap_content">
6566

@@ -75,6 +76,7 @@
7576

7677
<com.google.android.material.textfield.TextInputLayout
7778
android:id="@+id/passwordWrapper"
79+
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
7880
android:layout_width="match_parent"
7981
android:layout_height="wrap_content"
8082
app:passwordToggleEnabled="true">
@@ -124,6 +126,7 @@
124126

125127
<com.google.android.material.textfield.TextInputLayout
126128
android:id="@+id/emailWrapper"
129+
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
127130
android:layout_width="match_parent"
128131
android:layout_height="wrap_content"
129132
android:visibility="gone"

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656

5757
<com.google.android.material.textfield.TextInputLayout
5858
android:id="@+id/nameWrapper"
59+
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
5960
android:layout_width="match_parent"
6061
android:layout_height="wrap_content">
6162

@@ -71,6 +72,7 @@
7172

7273
<com.google.android.material.textfield.TextInputLayout
7374
android:id="@+id/passwordWrapper"
75+
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
7476
android:layout_width="match_parent"
7577
android:layout_height="wrap_content"
7678
app:passwordToggleEnabled="true">

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444

4545
<com.google.android.material.textfield.TextInputLayout
4646
android:id="@+id/textWrapper"
47+
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
4748
android:layout_width="match_parent"
4849
android:layout_height="wrap_content"
4950
android:visibility="gone"
@@ -59,6 +60,7 @@
5960

6061
<com.google.android.material.textfield.TextInputLayout
6162
android:id="@+id/passwordWrapper"
63+
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
6264
android:layout_width="match_parent"
6365
android:layout_height="wrap_content"
6466
android:visibility="gone"

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,27 @@
44
android:orientation="horizontal"
55
android:layout_width="match_parent"
66
android:layout_height="wrap_content"
7-
android:minHeight="48dp"
87
android:gravity="center_vertical"
9-
style="?attr/spinnerDropDownItemStyle">
8+
android:padding="16dp">
109

11-
<CheckedTextView
10+
<TextView
1211
android:id="@+id/name"
1312
android:singleLine="true"
1413
android:layout_width="0dp"
1514
android:layout_weight="1.0"
1615
android:layout_height="wrap_content"
17-
android:ellipsize="marquee"
16+
android:ellipsize="end"
17+
android:textAppearance="?attr/textAppearanceSubtitle1"
1818
tools:text="Arnhem" />
1919

2020
<TextView
2121
android:id="@+id/distance"
2222
android:singleLine="true"
2323
android:layout_width="wrap_content"
2424
android:layout_height="wrap_content"
25-
android:ellipsize="marquee"
25+
android:ellipsize="end"
26+
android:textAppearance="?attr/textAppearanceCaption"
27+
android:layout_marginStart="4dp"
2628
android:visibility="gone"
2729
tools:visibility="visible"
2830
tools:text="20 km" />

0 commit comments

Comments
 (0)