Skip to content

Commit

Permalink
add test to registration button. Force english phone format in spanis…
Browse files Browse the repository at this point in the history
…h mode

update activity transition
  • Loading branch information
Aaron Huttner authored and Aaron Huttner committed Aug 30, 2016
1 parent 30c6f11 commit e2cf6c1
Show file tree
Hide file tree
Showing 8 changed files with 397 additions and 14 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 = 1
def versionPatch = 1
def versionPatch = 2
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
@@ -1,6 +1,7 @@
package com.rockthevote.grommet.ui;

import android.Manifest;
import android.app.ActivityOptions;
import android.app.AlertDialog;
import android.content.Intent;
import android.content.pm.PackageManager;
Expand Down Expand Up @@ -164,7 +165,8 @@ private void createNewVoterRecord() {

long rockyRequestRowId = db.insert(RockyRequest.TABLE, builder.build());
currentRockyRequestId.set(rockyRequestRowId);
startActivity(new Intent(this, RegistrationActivity.class));
startActivity(new Intent(this, RegistrationActivity.class),
ActivityOptions.makeSceneTransitionAnimation(this).toBundle());
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import android.widget.EditText;

import com.f2prateek.rx.preferences.Preference;
import com.google.i18n.phonenumbers.PhoneNumberUtil;
import com.jakewharton.rxbinding.widget.RxCompoundButton;
import com.jakewharton.rxbinding.widget.RxTextView;
import com.mobsandgeeks.saripaar.Validator;
Expand Down Expand Up @@ -192,10 +193,11 @@ public void onActivityCreated(@Nullable Bundle savedInstanceState) {
@Override
public void onResume() {
super.onResume();
phoneFormatter = new PhoneNumberFormattingTextWatcher();
phone.addTextChangedListener(phoneFormatter);
subscriptions = new CompositeSubscription();

phoneFormatter = new PhoneNumberFormattingTextWatcher("en");
phone.addTextChangedListener(phoneFormatter);

subscriptions.add(RxTextView.afterTextChangeEvents(raceSpinner.getEditText())
.observeOn(Schedulers.io())
.skip(1)
Expand Down Expand Up @@ -328,13 +330,14 @@ public void onResume() {
.build(),
RockyRequest._ID + " = ? ", String.valueOf(rockyRequestRowId.get()));
}));

}

@Override
public void onPause() {
super.onPause();
phone.removeTextChangedListener(phoneFormatter);
subscriptions.unsubscribe();
phone.removeTextChangedListener(phoneFormatter);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,11 @@ public void onViewCreated(View view, Bundle savedInstanceState) {
@Override
public void onResume() {
super.onResume();
phoneFormatter = new PhoneNumberFormattingTextWatcher();
subscriptions = new CompositeSubscription();

phoneFormatter = new PhoneNumberFormattingTextWatcher("en");
phoneEditText.addTextChangedListener(phoneFormatter);

subscriptions = new CompositeSubscription();
subscriptions.add(RxTextView.afterTextChangeEvents(phoneEditText)
.observeOn(Schedulers.io())
.debounce(DEBOUNCE, TimeUnit.MILLISECONDS)
Expand All @@ -107,8 +108,8 @@ public void onResume() {
@Override
public void onPause() {
super.onPause();
phoneEditText.removeTextChangedListener(phoneFormatter);
subscriptions.unsubscribe();
phoneEditText.removeTextChangedListener(phoneFormatter);
}

@OnCheckedChanged(R.id.checkbox_has_assistant)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
import android.support.design.widget.AppBarLayout;
import android.support.v4.view.ViewPager;
import android.support.v7.widget.Toolbar;
import android.transition.Slide;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.Button;
import android.widget.LinearLayout;

Expand Down Expand Up @@ -61,6 +63,11 @@ public RegistrationActivity() {

@Override
protected void onCreate(Bundle savedInstanceState) {
// inside your activity (if you did not enable transitions in your theme)
getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
getWindow().setExitTransition(new Slide());
getWindow().setEnterTransition(new Slide());

super.onCreate(savedInstanceState);

ViewGroup contentView = getContentView();
Expand Down Expand Up @@ -123,12 +130,16 @@ public boolean onOptionsItemSelected(MenuItem item) {
showCancelDialog();
return true;
case R.id.action_english:
LocaleUtils.setLocale(new Locale("en"));
recreate();
if (!Locale.getDefault().equals(new Locale("en"))) {
LocaleUtils.setLocale(new Locale("en"));
recreate();
}
return true;
case R.id.action_espanol:
LocaleUtils.setLocale(new Locale("es"));
recreate();
if (!Locale.getDefault().equals(new Locale("es"))) {
LocaleUtils.setLocale(new Locale("es"));
recreate();
}
return true;
default:
return super.onOptionsItemSelected(item);
Expand Down
Loading

0 comments on commit e2cf6c1

Please sign in to comment.