diff --git a/app/src/main/java/com/rockthevote/grommet/data/api/RegistrationService.java b/app/src/main/java/com/rockthevote/grommet/data/api/RegistrationService.java index 8a623457..44c1b3ae 100644 --- a/app/src/main/java/com/rockthevote/grommet/data/api/RegistrationService.java +++ b/app/src/main/java/com/rockthevote/grommet/data/api/RegistrationService.java @@ -49,9 +49,9 @@ import rx.schedulers.Schedulers; import timber.log.Timber; -import static com.rockthevote.grommet.data.db.model.Address.Type.MAILING; -import static com.rockthevote.grommet.data.db.model.Address.Type.PREVIOUS; -import static com.rockthevote.grommet.data.db.model.Address.Type.REGISTRATION; +import static com.rockthevote.grommet.data.db.model.Address.Type.MAILING_ADDRESS; +import static com.rockthevote.grommet.data.db.model.Address.Type.PREVIOUS_ADDRESS; +import static com.rockthevote.grommet.data.db.model.Address.Type.REGISTRATION_ADDRESS; import static com.rockthevote.grommet.data.db.model.RockyRequest.GENERATED_DATE; import static com.rockthevote.grommet.data.db.model.RockyRequest.STATUS; import static com.rockthevote.grommet.data.db.model.RockyRequest.Status.ABANDONED; @@ -265,11 +265,11 @@ private ApiRockyRequestWrapper zipRockyRequest(RockyRequest rockyRequest, EnumMap additionalInfo) { - ApiAddress apiRegAddress = ApiAddress.fromDb(addresses.get(REGISTRATION)); + ApiAddress apiRegAddress = ApiAddress.fromDb(addresses.get(REGISTRATION_ADDRESS)); ApiAddress apiMailAddress = rockyRequest.hasMailingAddress() ? - ApiAddress.fromDb(addresses.get(MAILING)) : null; + ApiAddress.fromDb(addresses.get(MAILING_ADDRESS)) : null; ApiAddress apiPrevAddress = rockyRequest.hasPreviousAddress() ? - ApiAddress.fromDb(addresses.get(PREVIOUS)) : null; + ApiAddress.fromDb(addresses.get(PREVIOUS_ADDRESS)) : null; ApiName apiName = ApiName.fromDb(names.get(Name.Type.CURRENT_NAME)); ApiName apiPrevName = rockyRequest.hasPreviousName() ? diff --git a/app/src/main/java/com/rockthevote/grommet/data/db/DbOpenHelper.java b/app/src/main/java/com/rockthevote/grommet/data/db/DbOpenHelper.java index 4309bcd7..71fb22cf 100644 --- a/app/src/main/java/com/rockthevote/grommet/data/db/DbOpenHelper.java +++ b/app/src/main/java/com/rockthevote/grommet/data/db/DbOpenHelper.java @@ -37,7 +37,7 @@ public class DbOpenHelper extends SQLiteOpenHelper { + RockyRequest.OPEN_TRACKING_ID + " TEXT," + RockyRequest.GENERATED_DATE + " TEXT NOT NULL," + RockyRequest.DATE_OF_BIRTH + " TEXT," - + RockyRequest.HAS_MAILING_ADDRESS + " INTEGER DEFAULT " + Db.BOOLEAN_TRUE + "," + + RockyRequest.HAS_MAILING_ADDRESS + " INTEGER DEFAULT " + Db.BOOLEAN_FALSE + "," + RockyRequest.RACE + " TEXT," + RockyRequest.PARTY + " TEXT," + RockyRequest.SIGNATURE + " BLOB," diff --git a/app/src/main/java/com/rockthevote/grommet/data/db/model/Address.java b/app/src/main/java/com/rockthevote/grommet/data/db/model/Address.java index e3b1c48a..4ec73b80 100644 --- a/app/src/main/java/com/rockthevote/grommet/data/db/model/Address.java +++ b/app/src/main/java/com/rockthevote/grommet/data/db/model/Address.java @@ -159,9 +159,10 @@ public ContentValues build() { } public enum Type { - MAILING("mailing_address"), - PREVIOUS("previous_address"), - REGISTRATION("registration_address"); + MAILING_ADDRESS("mailing_address"), + PREVIOUS_ADDRESS("previous_address"), + REGISTRATION_ADDRESS("registration_address"), + ASSISTANT_ADDRESS("assistant_address"); private final String type; @@ -180,7 +181,7 @@ public static Type fromString(String type) { return val; } } - return MAILING; + return MAILING_ADDRESS; } } diff --git a/app/src/main/java/com/rockthevote/grommet/data/db/model/ContactMethod.java b/app/src/main/java/com/rockthevote/grommet/data/db/model/ContactMethod.java index b9745cbf..9e5b3ac9 100644 --- a/app/src/main/java/com/rockthevote/grommet/data/db/model/ContactMethod.java +++ b/app/src/main/java/com/rockthevote/grommet/data/db/model/ContactMethod.java @@ -105,7 +105,9 @@ public static void insertOrUpdate(BriteDatabase db, long rockyRequestId, } public enum Type { - PHONE("phone"), EMAIL("email"); + PHONE("phone"), + ASSISTANT_PHONE("assistant_phone"), + EMAIL("email"); private final String type; diff --git a/app/src/main/java/com/rockthevote/grommet/data/db/model/Name.java b/app/src/main/java/com/rockthevote/grommet/data/db/model/Name.java index c07cf8a0..1df1deb5 100644 --- a/app/src/main/java/com/rockthevote/grommet/data/db/model/Name.java +++ b/app/src/main/java/com/rockthevote/grommet/data/db/model/Name.java @@ -149,7 +149,8 @@ public ContentValues build() { public enum Type { CURRENT_NAME("current_name"), - PREVIOUS_NAME("previous_name"); + PREVIOUS_NAME("previous_name"), + ASSISTANT_NAME("assistant_name"); private final String type; diff --git a/app/src/main/java/com/rockthevote/grommet/ui/UiModule.java b/app/src/main/java/com/rockthevote/grommet/ui/UiModule.java index ae90a72c..00979c4d 100644 --- a/app/src/main/java/com/rockthevote/grommet/ui/UiModule.java +++ b/app/src/main/java/com/rockthevote/grommet/ui/UiModule.java @@ -2,6 +2,7 @@ import com.rockthevote.grommet.ui.registration.AdditionalInfoFragment; +import com.rockthevote.grommet.ui.registration.AssistantInfoFragment; import com.rockthevote.grommet.ui.registration.NewRegistrantFragment; import com.rockthevote.grommet.ui.registration.PersonalInfoFragment; import com.rockthevote.grommet.ui.registration.RegistrationActivity; @@ -26,6 +27,7 @@ NewRegistrantFragment.class, PersonalInfoFragment.class, AdditionalInfoFragment.class, + AssistantInfoFragment.class, ReviewAndConfirmFragment.class, AddressView.class, NameView.class, diff --git a/app/src/main/java/com/rockthevote/grommet/ui/registration/AdditionalInfoFragment.java b/app/src/main/java/com/rockthevote/grommet/ui/registration/AdditionalInfoFragment.java index 19c4a6d1..48228ebe 100644 --- a/app/src/main/java/com/rockthevote/grommet/ui/registration/AdditionalInfoFragment.java +++ b/app/src/main/java/com/rockthevote/grommet/ui/registration/AdditionalInfoFragment.java @@ -102,8 +102,8 @@ public class AdditionalInfoFragment extends BaseRegistrationFragment { private PhoneNumberFormattingTextWatcher phoneFormatter; // must be initialized to true to trigger the observable default, unchecked, state (it's reversed) - private final BehaviorSubject doesNotHavePennDOT = BehaviorSubject.create(true); - private final BehaviorSubject doesNotHaveSSN = BehaviorSubject.create(true); + private final BehaviorSubject doesNotHavePennDOT = BehaviorSubject.create(false); + private final BehaviorSubject doesNotHaveSSN = BehaviorSubject.create(false); @Nullable @Override @@ -298,7 +298,7 @@ public void onDriversLicenseChecked(boolean checked) { // disabling it prevents Saripaar from trying to validate it pennDOTTIL.setEnabled(!checked); pennDOTTIL.setErrorEnabled(!checked); - doesNotHavePennDOT.onNext(!checked); + doesNotHavePennDOT.onNext(checked); } @OnCheckedChanged(R.id.ssn_last_four_checkbox) @@ -308,7 +308,7 @@ public void onSSNChecked(boolean checked) { // disabling it prevents Saripaar from trying to validate it ssnTIL.setEnabled(!checked); ssnTIL.setErrorEnabled(!checked); - doesNotHaveSSN.onNext(!checked); + doesNotHaveSSN.onNext(checked); } @Override diff --git a/app/src/main/java/com/rockthevote/grommet/ui/registration/AssistantInfoFragment.java b/app/src/main/java/com/rockthevote/grommet/ui/registration/AssistantInfoFragment.java new file mode 100644 index 00000000..aa884d4b --- /dev/null +++ b/app/src/main/java/com/rockthevote/grommet/ui/registration/AssistantInfoFragment.java @@ -0,0 +1,36 @@ +package com.rockthevote.grommet.ui.registration; + +import android.os.Bundle; +import android.support.annotation.Nullable; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import com.f2prateek.rx.preferences.Preference; +import com.rockthevote.grommet.R; +import com.rockthevote.grommet.data.prefs.CurrentRockyRequestId; +import com.squareup.sqlbrite.BriteDatabase; + +import javax.inject.Inject; + +import butterknife.ButterKnife; + +public class AssistantInfoFragment extends BaseRegistrationFragment { + + @Inject @CurrentRockyRequestId Preference rockyRequestRowId; + + @Inject BriteDatabase db; + + @Nullable + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + setContentView(R.layout.fragment_assistant_info); + return super.onCreateView(inflater, container, savedInstanceState); + } + + @Override + public void onViewCreated(View view, Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + ButterKnife.bind(this, view); + } +} diff --git a/app/src/main/java/com/rockthevote/grommet/ui/registration/RegistrationPagerAdapter.java b/app/src/main/java/com/rockthevote/grommet/ui/registration/RegistrationPagerAdapter.java index 6dcbfa89..3bb682ca 100644 --- a/app/src/main/java/com/rockthevote/grommet/ui/registration/RegistrationPagerAdapter.java +++ b/app/src/main/java/com/rockthevote/grommet/ui/registration/RegistrationPagerAdapter.java @@ -20,6 +20,7 @@ public RegistrationPagerAdapter(FragmentManager fm, Context context) { titles.put(0, context.getString(R.string.fragment_title_new_registrant)); titles.put(1, context.getString(R.string.fragment_title_personal_info)); titles.put(2, context.getString(R.string.fragment_title_additional_info)); +// titles.put(3, context.getString(R.string.fragment_title_assistant_info)); titles.put(3, context.getString(R.string.fragment_title_review)); } @@ -36,6 +37,8 @@ private Fragment getNewFragment(int position) { return new PersonalInfoFragment(); case 2: return new AdditionalInfoFragment(); +// case 3: +// return new AssistantInfoFragment(); case 3: return new ReviewAndConfirmFragment(); default: diff --git a/app/src/main/java/com/rockthevote/grommet/ui/registration/ReviewAndConfirmFragment.java b/app/src/main/java/com/rockthevote/grommet/ui/registration/ReviewAndConfirmFragment.java index 5c8e2147..e50c5af0 100644 --- a/app/src/main/java/com/rockthevote/grommet/ui/registration/ReviewAndConfirmFragment.java +++ b/app/src/main/java/com/rockthevote/grommet/ui/registration/ReviewAndConfirmFragment.java @@ -37,8 +37,8 @@ import rx.android.schedulers.AndroidSchedulers; import rx.subscriptions.CompositeSubscription; -import static com.rockthevote.grommet.data.db.model.Address.Type.MAILING; -import static com.rockthevote.grommet.data.db.model.Address.Type.REGISTRATION; +import static com.rockthevote.grommet.data.db.model.Address.Type.MAILING_ADDRESS; +import static com.rockthevote.grommet.data.db.model.Address.Type.REGISTRATION_ADDRESS; import static com.rockthevote.grommet.data.db.model.ContactMethod.Type.EMAIL; import static com.rockthevote.grommet.data.db.model.ContactMethod.Type.PHONE; import static com.rockthevote.grommet.data.db.model.Name.Type.CURRENT_NAME; @@ -103,7 +103,7 @@ public void onResume() { })); subscriptions.add(db.createQuery(Address.TABLE, Address.SELECT_BY_TYPE, - new String[]{String.valueOf(rockyRequestRowId.get()), REGISTRATION.toString()}) + new String[]{String.valueOf(rockyRequestRowId.get()), REGISTRATION_ADDRESS.toString()}) .mapToOne(Address.MAPPER) .observeOn(AndroidSchedulers.mainThread()) .subscribe(address -> { @@ -126,7 +126,7 @@ public void onResume() { })); subscriptions.add(db.createQuery(Address.TABLE, Address.SELECT_BY_TYPE, - new String[]{String.valueOf(rockyRequestRowId.get()), MAILING.toString()}) + new String[]{String.valueOf(rockyRequestRowId.get()), MAILING_ADDRESS.toString()}) .mapToOne(Address.MAPPER) .observeOn(AndroidSchedulers.mainThread()) .subscribe(address -> { diff --git a/app/src/main/java/com/rockthevote/grommet/ui/views/AddressView.java b/app/src/main/java/com/rockthevote/grommet/ui/views/AddressView.java index 818eb31d..7423fd25 100644 --- a/app/src/main/java/com/rockthevote/grommet/ui/views/AddressView.java +++ b/app/src/main/java/com/rockthevote/grommet/ui/views/AddressView.java @@ -102,14 +102,16 @@ public AddressView(Context context, AttributeSet attrs, int defStyleAttr) { int val = typedArray.getInt(R.styleable.AddressView_address_type, 0); switch (val) { case 1: - type = Address.Type.MAILING; + type = Address.Type.MAILING_ADDRESS; break; case 2: - type = Address.Type.PREVIOUS; + type = Address.Type.PREVIOUS_ADDRESS; break; case 3: - type = Address.Type.REGISTRATION; + type = Address.Type.REGISTRATION_ADDRESS; break; + case 4: + type = Address.Type.ASSISTANT_ADDRESS; } } finally { typedArray.recycle(); @@ -124,15 +126,17 @@ protected void onFinishInflate() { validator = new ObservableValidator(this, getContext()); switch (type) { - case REGISTRATION: + case REGISTRATION_ADDRESS: sectionTitle.setText(R.string.section_label_registration_address); break; - case MAILING: + case MAILING_ADDRESS: sectionTitle.setText(R.string.section_label_mailing_address); break; - case PREVIOUS: + case PREVIOUS_ADDRESS: sectionTitle.setText(R.string.section_label_previous_address); break; + case ASSISTANT_ADDRESS: + sectionTitle.setText(R.string.section_label_registration_address); } countyAdapter = ArrayAdapter.createFromResource(getContext(), diff --git a/app/src/main/java/com/rockthevote/grommet/ui/views/NameView.java b/app/src/main/java/com/rockthevote/grommet/ui/views/NameView.java index dd39c134..fad24362 100644 --- a/app/src/main/java/com/rockthevote/grommet/ui/views/NameView.java +++ b/app/src/main/java/com/rockthevote/grommet/ui/views/NameView.java @@ -101,6 +101,9 @@ public NameView(Context context, AttributeSet attrs, int defStyleAttr) { case 2: type = Name.Type.PREVIOUS_NAME; break; + case 3: + type = Name.Type.ASSISTANT_NAME; + break; } } finally { typedArray.recycle(); @@ -123,6 +126,9 @@ protected void onFinishInflate() { case PREVIOUS_NAME: sectionTitle.setText(R.string.section_label_previous_name); break; + case ASSISTANT_NAME: + sectionTitle.setText(R.string.section_label_name); + break; } titleEnumAdapter = new EnumAdapter<>(getContext(), Name.Prefix.class); diff --git a/app/src/main/res/layout/activity_registration.xml b/app/src/main/res/layout/activity_registration.xml index 8caa7cf8..15e5bb79 100644 --- a/app/src/main/res/layout/activity_registration.xml +++ b/app/src/main/res/layout/activity_registration.xml @@ -31,6 +31,8 @@ android:layout_height="@dimen/increment" android:background="@android:color/transparent" android:elevation="4dp" + app:tabMode="fixed" + app:tabGravity="fill" tools:background="@color/colorSecondaryText" /> diff --git a/app/src/main/res/layout/fragment_additional_info.xml b/app/src/main/res/layout/fragment_additional_info.xml index f59d0985..d3975b75 100644 --- a/app/src/main/res/layout/fragment_additional_info.xml +++ b/app/src/main/res/layout/fragment_additional_info.xml @@ -209,4 +209,5 @@ android:paddingBottom="@dimen/content_area_padding" android:paddingTop="@dimen/content_area_padding" android:text="@string/label_receive_text"/> + diff --git a/app/src/main/res/layout/fragment_assistant_info.xml b/app/src/main/res/layout/fragment_assistant_info.xml new file mode 100644 index 00000000..f54a2104 --- /dev/null +++ b/app/src/main/res/layout/fragment_assistant_info.xml @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/tab_stepper.xml b/app/src/main/res/layout/tab_stepper.xml index eb798318..6ac408f6 100644 --- a/app/src/main/res/layout/tab_stepper.xml +++ b/app/src/main/res/layout/tab_stepper.xml @@ -6,7 +6,7 @@ android:layout_height="wrap_content" android:background="@android:color/transparent" android:gravity="center" - android:orientation="horizontal"> + android:orientation="vertical"> + @@ -12,6 +13,7 @@ + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 73f5f759..d81dd1c5 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -29,7 +29,7 @@ No - New Registrant + Name I am a U.S. Citizen I will be 18 or older by the next election I have a driver\'s license or state ID card. @@ -55,8 +55,8 @@ - Personal Info - Personal Information + Address + Address Information Name Previous Name Registration Address @@ -78,7 +78,8 @@ Invalid phone number - Additional Info + Personal + Assistance Gender Race Political Party @@ -102,6 +103,8 @@ Election Info Check "I do not know" if you don\'t know your PennDOT number Check "I do not know" if you don\'t know your SSN last four + Did someone helped you with this form? + Helper Info Review