Skip to content

Commit cf3b0d3

Browse files
Aaron HuttnerAaron Huttner
authored andcommitted
Move Name to New Registrant screen, move email and phone to Additional Info
fix keyboard scrolling bug update api endpoints
1 parent 8e0cb90 commit cf3b0d3

35 files changed

Lines changed: 667 additions & 510 deletions

.idea/gradle.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ dependencies {
143143
compile "com.android.support:cardview-v7:${supportLibVersion}"
144144
compile "com.android.support:design:${supportLibVersion}"
145145
compile 'com.google.android.gms:play-services-location:9.4.0'
146+
compile 'com.googlecode.libphonenumber:libphonenumber:7.5.2'
146147

147148
apt 'com.squareup.dagger:dagger-compiler:1.2.2'
148149

app/src/internalDebug/java/com/rockthevote/grommet/data/ApiEndpoints.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
public enum ApiEndpoints {
66
PRODUCTION("Production", ApiModule.PRODUCTION_API_URL.toString()),
7-
STAGING("Staging","https://staging.rocky.rockthevote.com/v3"),
7+
STAGING("Staging","https://staging.rocky.rockthevote.com/v3/"),
88
MOCK_MODE("Mock Mode", "http://localhost/mock/");
99
public final String name;
1010
public final String url;

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
<intent-filter>
2828
<action android:name="android.intent.action.MAIN"/>
2929

30+
<category android:name="android.intent.category.DEFAULT"/>
3031
<category android:name="android.intent.category.LAUNCHER"/>
3132
</intent-filter>
3233
</activity>

app/src/main/java/com/rockthevote/grommet/data/api/ApiModule.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
library = true
1919
)
2020
public final class ApiModule {
21-
public static final HttpUrl PRODUCTION_API_URL = HttpUrl.parse("http://register.rockthevote.org/v3");
21+
public static final HttpUrl PRODUCTION_API_URL = HttpUrl.parse("http://register.rockthevote.org/v3/");
2222

2323
@Provides @Singleton HttpUrl provideBaseUrl() {
2424
return PRODUCTION_API_URL;
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
package com.rockthevote.grommet.ui.misc;
2+
3+
import android.content.Context;
4+
import android.support.annotation.NonNull;
5+
import android.support.design.widget.TextInputEditText;
6+
import android.support.design.widget.TextInputLayout;
7+
import android.support.v7.widget.ListPopupWindow;
8+
import android.util.AttributeSet;
9+
import android.widget.AdapterView;
10+
import android.widget.ListAdapter;
11+
12+
import com.rockthevote.grommet.R;
13+
14+
15+
public class BetterSpinner extends TextInputLayout {
16+
17+
ListPopupWindow listPopupWindow;
18+
ListAdapter listAdapter;
19+
TextInputEditText editText;
20+
21+
public BetterSpinner(Context context) {
22+
this(context, null);
23+
}
24+
25+
public BetterSpinner(Context context, AttributeSet attrs) {
26+
this(context, attrs, 0);
27+
}
28+
29+
public BetterSpinner(Context context, AttributeSet attrs, int defStyleAttr) {
30+
super(context, attrs, defStyleAttr);
31+
32+
editText = new TextInputEditText(context);
33+
editText.setId(R.id.titleId);
34+
editText.setHeight((int) getResources().getDimension(R.dimen.list_item_height));
35+
editText.setFocusable(false);
36+
editText.setMaxLines(1);
37+
editText.setCursorVisible(false);
38+
editText.setCompoundDrawablesRelativeWithIntrinsicBounds(0, 0,
39+
R.drawable.drop_down_arrow, 0);
40+
41+
addView(editText, 0);
42+
listPopupWindow = new ListPopupWindow(context);
43+
listPopupWindow.setAnchorView(editText);
44+
}
45+
46+
public void setAdapter(ListAdapter listAdapter) {
47+
this.listAdapter = listAdapter;
48+
listPopupWindow.setAdapter(listAdapter);
49+
getEditText().setOnClickListener(view -> listPopupWindow.show());
50+
}
51+
52+
public void setOnItemClickListener(AdapterView.OnItemClickListener listener) {
53+
listPopupWindow.setOnItemClickListener(listener);
54+
}
55+
56+
public void dismiss() {
57+
listPopupWindow.dismiss();
58+
}
59+
60+
/**
61+
* set the height of the popup window in pixes
62+
*/
63+
public void setHeight(int height) {
64+
listPopupWindow.setHeight(height);
65+
}
66+
67+
@NonNull
68+
@Override
69+
public TextInputEditText getEditText() {
70+
return editText;
71+
}
72+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.rockthevote.grommet.ui.misc;
2+
3+
import com.mobsandgeeks.saripaar.adapter.ViewDataAdapter;
4+
import com.mobsandgeeks.saripaar.exception.ConversionException;
5+
6+
public class BetterSpinnerValidator implements ViewDataAdapter<BetterSpinner, String> {
7+
@Override
8+
public String getData(BetterSpinner view) throws ConversionException {
9+
if (view.getEditText() != null) {
10+
return view.getEditText().getText().toString();
11+
} else {
12+
return "";
13+
}
14+
}
15+
}

app/src/main/java/com/rockthevote/grommet/ui/misc/BottomBarBehavior.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ public void onNestedScroll(final CoordinatorLayout coordinatorLayout, final V ch
5353
final View target, final int dxConsumed, final int dyConsumed,
5454
final int dxUnconsumed, final int dyUnconsumed) {
5555
super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);
56-
if (dyConsumed > 10 && child.getVisibility() != View.VISIBLE) {
56+
if (dyConsumed > 0 && child.getVisibility() != View.VISIBLE) {
57+
animateIn(child);
58+
} else if (dyConsumed == 0 && dyUnconsumed > 0 && child.getVisibility() != View.VISIBLE) {
5759
animateIn(child);
5860
} else if (dyConsumed < 0 && !this.mIsAnimatingOut && child.getVisibility() == View.VISIBLE) {
5961
animateOut(child);

app/src/main/java/com/rockthevote/grommet/ui/misc/ObservableValidator.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public class ObservableValidator {
1919
public ObservableValidator(Object controller, Context context) {
2020
Validator validator = new Validator(controller);
2121
validator.registerAdapter(TextInputLayout.class, new TilStringValidator());
22+
validator.registerAdapter(BetterSpinner.class, new BetterSpinnerValidator());
2223
validator.setViewValidatedAction(new Validator.ViewValidatedAction() {
2324
@Override
2425
public void onAllRulesPassed(View view) {

0 commit comments

Comments
 (0)