Skip to content

Commit

Permalink
update opt-ins to be partner opt-ins. Make email opt-in default true.…
Browse files Browse the repository at this point in the history
… Add email text blurb

add PennDOT and SSN enforcement text
update spacing for error labels
don't kill app when wifi is turned off
changed helped --> help
fix county spinner
version bump
  • Loading branch information
Aaron Huttner authored and Aaron Huttner committed Aug 25, 2016
1 parent a173650 commit 9bad819
Show file tree
Hide file tree
Showing 14 changed files with 100 additions and 57 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Manifest version information!
def versionMajor = 1
def versionMinor = 0
def versionPatch = 5
def versionPatch = 6
def versionBuild = 0 // bump for dogfood builds, public betas, etc.

apply plugin: 'com.android.application'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ private void doWorkIfNeeded() {
PackageManager pm = context.getPackageManager();

pm.setComponentEnabledSetting(receiver,
PackageManager.COMPONENT_ENABLED_STATE_ENABLED, 0);
PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);

stopSelf();
}
Expand All @@ -156,6 +156,7 @@ private void doWork(final RockyRequest rockyRequest) {
RockyRequest.Status status =
!regResponse.isError() && regResponse.response().isSuccessful()
? REGISTER_SUCCESS : REGISTER_SERVER_FAILURE;


UploadNotification.notify(getApplicationContext(), status);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ static Builder builder() {
.optInEmail(false)
.optInSms(false)
.optInVolunteer(false)
.partnerOptInEmail(false)
.partnerOptInSms(false)
.partnerOptInVolunteer(false)
.finishWithState(true)
.createdViaApi(true);
Expand Down Expand Up @@ -123,8 +121,8 @@ public static ApiRockyRequest fromDb(RockyRequest rockyRequest,
return builder()
.phoneType(rockyRequest.phoneType().toString())
.partnerId(rockyRequest.partnerId())
.optInEmail(rockyRequest.optInEmail())
.optInSms(rockyRequest.optInSMS())
.partnerOptInEmail(rockyRequest.partnerOptInEmail())
.partnerOptInSms(rockyRequest.partnerOptInSMS())
.optInVolunteer(rockyRequest.optInVolunteer())
.sourceTrackingId(rockyRequest.sourceTrackingId())
.partnerTrackingId(rockyRequest.partnerTrackingId())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class DbOpenHelper extends SQLiteOpenHelper {
+ RockyRequest.OPT_IN_SMS + " INTEGER DEFAULT " + Db.BOOLEAN_FALSE + ","
+ RockyRequest.OPT_IN_VOLUNTEER + " INTEGER DEFAULT " + Db.BOOLEAN_FALSE + ","
+ RockyRequest.PARTNER_OPT_IN_SMS + " INTEGER DEFAULT " + Db.BOOLEAN_FALSE + ","
+ RockyRequest.PARTNER_OPT_IN_EMAIL + " INTEGER DEFAULT " + Db.BOOLEAN_FALSE + ","
+ RockyRequest.PARTNER_OPT_IN_EMAIL + " INTEGER DEFAULT " + Db.BOOLEAN_TRUE + ","
+ RockyRequest.SOURCE_TRACKING_ID + " TEXT,"
+ RockyRequest.PARTNER_TRACKING_ID + " TEXT,"
+ RockyRequest.OPEN_TRACKING_ID + " TEXT,"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,13 +309,9 @@ public static Race fromString(String race) {
}

public enum Party {
OTHER("Other"),
DEMOCRATIC("Democratic"),
GREEN("Green"),
INDEPENDENT("Independent"),
LIBERTARIAN("Libertarian"),
REPUBLICAN("Republican"),
NONE("None");
OTHER("Other");

private final String party;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public ObservableValidator(Object controller, Context context) {
public void onAllRulesPassed(View view) {
if (view instanceof TextInputLayout) {
((TextInputLayout) view).setError(null);
((TextInputLayout) view).setErrorEnabled(false);
} else if (view instanceof CheckBox) {
((CheckBox) view).setError(null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ public void onViewCreated(View view, Bundle savedInstanceState) {
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
phoneOptIn.setText(getString(R.string.label_receive_text, partnerNamePref.get()));
emailOptIn.setText(getString(R.string.label_receive_email, partnerNamePref.get()));
}

@Override
Expand Down Expand Up @@ -243,7 +244,7 @@ public void onResume() {
db.update(
RockyRequest.TABLE,
new RockyRequest.Builder()
.optInEmail(checked)
.partnerOptInEmail(checked)
.build(),
RockyRequest._ID + " = ? ", String.valueOf(rockyRequestRowId.get()));
}));
Expand Down Expand Up @@ -280,7 +281,7 @@ public void onResume() {
db.update(
RockyRequest.TABLE,
new RockyRequest.Builder()
.optInSMS(checked)
.partnerOptInSMS(checked)
.build(),
RockyRequest._ID + " = ? ", String.valueOf(rockyRequestRowId.get()));
}));
Expand All @@ -304,7 +305,9 @@ public void onDriversLicenseChecked(boolean checked) {

// disabling it prevents Saripaar from trying to validate it
pennDOTTIL.setEnabled(!checked);
pennDOTTIL.setErrorEnabled(!checked);
if (checked) {
pennDOTTIL.setErrorEnabled(false);
}
doesNotHavePennDOT.onNext(checked);
}

Expand All @@ -314,7 +317,9 @@ public void onSSNChecked(boolean checked) {

// disabling it prevents Saripaar from trying to validate it
ssnTIL.setEnabled(!checked);
ssnTIL.setErrorEnabled(!checked);
if (checked) {
ssnTIL.setErrorEnabled(false);
}
doesNotHaveSSN.onNext(checked);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ protected void onAttachedToWindow() {
RxTextView.afterTextChangeEvents(cityEditText),
RxTextView.afterTextChangeEvents(stateSpinner.getEditText()),
RxTextView.afterTextChangeEvents(zipEditText),
RxTextView.afterTextChangeEvents(stateSpinner.getEditText()),
RxTextView.afterTextChangeEvents(countySpinner.getEditText()),
(street, unit, city, state, zip, county) -> new Address.Builder()
.streetName(street.editable().toString())
.subAddress(unit.editable().toString())
Expand Down
61 changes: 47 additions & 14 deletions app/src/main/res/layout/fragment_additional_info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<GridLayout
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="wrap_content"
android:animateLayoutChanges="true"
Expand All @@ -30,7 +31,7 @@
android:layout_marginStart="@dimen/content_margin"
android:paddingBottom="@dimen/content_area_padding"
android:paddingTop="@dimen/content_area_padding"
app:errorEnabled="true"
app:errorEnabled="false"
>

<android.support.design.widget.TextInputEditText
Expand All @@ -39,7 +40,8 @@
android:layout_height="wrap_content"
android:hint="@string/preferred_language_label"
android:inputType="text"
android:maxLines="1"/>
android:maxLines="1"
android:text="@string/preferred_language_default"/>

</android.support.design.widget.TextInputLayout>

Expand All @@ -51,7 +53,7 @@
android:layout_marginEnd="@dimen/content_margin"
android:layout_marginStart="@dimen/content_margin"
android:hint="@string/section_label_race"
app:errorEnabled="true"/>
app:errorEnabled="false"/>

<com.rockthevote.grommet.ui.misc.BetterSpinner
android:id="@+id/spinner_party"
Expand All @@ -61,8 +63,18 @@
android:layout_marginEnd="@dimen/content_margin"
android:layout_marginStart="@dimen/content_margin"
android:hint="@string/section_label_party"
app:errorEnabled="true"/>
android:paddingBottom="@dimen/content_area_padding"
app:errorEnabled="false"/>

<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_columnSpan="2"
android:layout_gravity="fill_horizontal"
android:layout_marginEnd="@dimen/content_margin"
android:layout_marginStart="@dimen/content_margin"
android:paddingTop="@dimen/content_area_padding"
android:text="@string/penn_dot_enforcer_text"/>

<android.support.design.widget.TextInputLayout
android:id="@+id/til_penn_dot"
Expand All @@ -71,15 +83,15 @@
android:layout_gravity="fill_horizontal"
android:layout_marginEnd="@dimen/content_margin"
android:layout_marginStart="@dimen/content_margin"
app:errorEnabled="true"
app:errorEnabled="false"
>

<android.support.design.widget.TextInputEditText
android:id="@+id/penn_dot_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/label_drivers_license_id"
android:digits="0123456789"
android:hint="@string/label_drivers_license_id"
android:inputType="number"
android:maxLength="8"
android:maxLines="1"/>
Expand All @@ -91,18 +103,29 @@
android:layout_width="wrap_content"
android:layout_columnSpan="2"
android:layout_marginStart="@dimen/content_margin"
android:gravity="bottom"
android:paddingBottom="@dimen/content_area_padding"
android:paddingTop="@dimen/content_area_padding"
android:text="@string/label_does_not_have_penn_dot"/>


<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_columnSpan="2"
android:layout_gravity="fill_horizontal"
android:layout_marginEnd="@dimen/content_margin"
android:layout_marginStart="@dimen/content_margin"
android:paddingTop="@dimen/content_area_padding"
android:text="@string/ssn_enforcer_text"/>

<android.support.design.widget.TextInputLayout
android:id="@+id/til_ssn_last_four"
android:layout_width="0dip"
android:layout_columnSpan="2"
android:layout_gravity="fill_horizontal"
android:layout_marginEnd="@dimen/content_margin"
android:layout_marginStart="@dimen/content_margin"
app:errorEnabled="true"
app:errorEnabled="false"
>

<android.support.design.widget.TextInputEditText
Expand All @@ -121,8 +144,8 @@
android:layout_width="wrap_content"
android:layout_columnSpan="2"
android:layout_marginStart="@dimen/content_margin"
android:gravity="bottom"
android:paddingBottom="@dimen/content_area_padding"
android:paddingTop="@dimen/content_area_padding"
android:text="@string/label_does_not_have_ssn"/>

<View
Expand All @@ -144,6 +167,15 @@
android:text="@string/section_label_contact_info"
android:textAppearance="@android:style/TextAppearance.Material.Subhead"/>

<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_columnSpan="2"
android:layout_gravity="fill_horizontal"
android:layout_marginEnd="@dimen/content_margin"
android:layout_marginStart="@dimen/content_margin"
android:text="@string/label_email_confirmation"/>

<android.support.design.widget.TextInputLayout
android:id="@+id/til_email"
android:layout_width="0dp"
Expand All @@ -152,12 +184,12 @@
android:layout_gravity="fill_horizontal"
android:layout_marginEnd="@dimen/content_margin"
android:layout_marginStart="@dimen/content_margin"
app:errorEnabled="true">
app:errorEnabled="false">

<android.support.design.widget.TextInputEditText
android:id="@+id/email_edit_text"
android:layout_width="match_parent"
android:layout_height="@dimen/list_item_height"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/content_area_padding"
android:hint="@string/label_email"
android:inputType="textEmailAddress"
Expand All @@ -172,9 +204,10 @@
android:layout_columnSpan="2"
android:layout_marginEnd="@dimen/content_margin"
android:layout_marginStart="@dimen/content_margin"
android:checked="true"
android:paddingBottom="@dimen/content_area_padding"
android:paddingTop="@dimen/content_area_padding"
android:text="@string/label_receive_email"/>
tools:text="@string/label_receive_email"/>

<android.support.design.widget.TextInputLayout
android:id="@+id/til_phone_number"
Expand All @@ -183,7 +216,7 @@
android:layout_columnWeight=".7"
android:layout_gravity="fill_horizontal"
android:layout_marginStart="@dimen/content_margin"
app:errorEnabled="true">
app:errorEnabled="false">

<android.support.design.widget.TextInputEditText
android:id="@+id/phone"
Expand All @@ -202,7 +235,7 @@
android:layout_gravity="fill_horizontal"
android:layout_marginEnd="@dimen/content_margin"
android:hint="@string/label_phone_type"
app:errorEnabled="true"/>
app:errorEnabled="false"/>

<CheckBox
android:id="@+id/checkbox_can_receive_text"
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/res/layout/fragment_assistant_info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
android:layout_gravity="fill_horizontal"
android:layout_marginEnd="@dimen/content_margin"
android:layout_marginStart="@dimen/content_margin"
app:errorEnabled="true">
app:errorEnabled="false">

<android.support.design.widget.TextInputEditText
android:id="@+id/assistant_phone"
Expand All @@ -130,7 +130,6 @@
android:paddingTop="@dimen/content_area_padding"
android:layout_marginStart="@dimen/content_margin"
android:layout_marginEnd="@dimen/content_margin"
android:textStyle="bold"
android:text="@string/label_assistant_declaration"/>

<CheckBox
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/fragment_new_registrant.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/content_margin"
android:layout_marginStart="@dimen/content_margin"
app:errorEnabled="true"
app:errorEnabled="false"
>

<android.support.design.widget.TextInputEditText
Expand Down
12 changes: 6 additions & 6 deletions app/src/main/res/layout/view_address.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
android:layout_gravity="fill_horizontal"
android:layout_marginEnd="@dimen/content_margin"
android:layout_marginStart="@dimen/content_margin"
app:errorEnabled="true"
app:errorEnabled="false"
>

<android.support.design.widget.TextInputEditText
Expand All @@ -43,7 +43,7 @@
android:layout_width="0dp"
android:layout_gravity="fill_horizontal"
android:layout_marginStart="@dimen/content_margin"
app:errorEnabled="true"
app:errorEnabled="false"
>

<android.support.design.widget.TextInputEditText
Expand All @@ -63,7 +63,7 @@
android:layout_gravity="fill_horizontal"
android:layout_marginEnd="@dimen/content_margin"
android:hint="@string/label_county"
app:errorEnabled="true"
app:errorEnabled="false"
/>

<android.support.design.widget.TextInputLayout
Expand All @@ -72,7 +72,7 @@
android:layout_columnWeight=".7"
android:layout_gravity="fill_horizontal"
android:layout_marginStart="@dimen/content_margin"
app:errorEnabled="true"
app:errorEnabled="false"
>

<android.support.design.widget.TextInputEditText
Expand All @@ -91,15 +91,15 @@
android:layout_columnWeight=".3"
android:layout_gravity="fill_horizontal"
android:hint="@string/label_state"
app:errorEnabled="true"/>
app:errorEnabled="false"/>

<android.support.design.widget.TextInputLayout
android:id="@+id/til_zip_code"
android:layout_width="0dp"
android:layout_columnWeight=".3"
android:layout_gravity="fill_horizontal"
android:layout_marginEnd="@dimen/content_margin"
app:errorEnabled="true"
app:errorEnabled="false"
>

<android.support.design.widget.TextInputEditText
Expand Down
Loading

0 comments on commit 9bad819

Please sign in to comment.