Skip to content

Commit a4a8011

Browse files
authored
Merge pull request #92 from huttneab/little_changes_2
add test to registration button.
2 parents 30c6f11 + e2cf6c1 commit a4a8011

8 files changed

Lines changed: 397 additions & 14 deletions

File tree

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Manifest version information!
22
def versionMajor = 1
33
def versionMinor = 1
4-
def versionPatch = 1
4+
def versionPatch = 2
55
def versionBuild = 0 // bump for dogfood builds, public betas, etc.
66

77
apply plugin: 'com.android.application'

app/src/main/java/com/rockthevote/grommet/ui/MainActivity.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.rockthevote.grommet.ui;
22

33
import android.Manifest;
4+
import android.app.ActivityOptions;
45
import android.app.AlertDialog;
56
import android.content.Intent;
67
import android.content.pm.PackageManager;
@@ -164,7 +165,8 @@ private void createNewVoterRecord() {
164165

165166
long rockyRequestRowId = db.insert(RockyRequest.TABLE, builder.build());
166167
currentRockyRequestId.set(rockyRequestRowId);
167-
startActivity(new Intent(this, RegistrationActivity.class));
168+
startActivity(new Intent(this, RegistrationActivity.class),
169+
ActivityOptions.makeSceneTransitionAnimation(this).toBundle());
168170
});
169171
}
170172

app/src/main/java/com/rockthevote/grommet/ui/registration/AdditionalInfoFragment.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import android.widget.EditText;
1212

1313
import com.f2prateek.rx.preferences.Preference;
14+
import com.google.i18n.phonenumbers.PhoneNumberUtil;
1415
import com.jakewharton.rxbinding.widget.RxCompoundButton;
1516
import com.jakewharton.rxbinding.widget.RxTextView;
1617
import com.mobsandgeeks.saripaar.Validator;
@@ -192,10 +193,11 @@ public void onActivityCreated(@Nullable Bundle savedInstanceState) {
192193
@Override
193194
public void onResume() {
194195
super.onResume();
195-
phoneFormatter = new PhoneNumberFormattingTextWatcher();
196-
phone.addTextChangedListener(phoneFormatter);
197196
subscriptions = new CompositeSubscription();
198197

198+
phoneFormatter = new PhoneNumberFormattingTextWatcher("en");
199+
phone.addTextChangedListener(phoneFormatter);
200+
199201
subscriptions.add(RxTextView.afterTextChangeEvents(raceSpinner.getEditText())
200202
.observeOn(Schedulers.io())
201203
.skip(1)
@@ -328,13 +330,14 @@ public void onResume() {
328330
.build(),
329331
RockyRequest._ID + " = ? ", String.valueOf(rockyRequestRowId.get()));
330332
}));
333+
331334
}
332335

333336
@Override
334337
public void onPause() {
335338
super.onPause();
336-
phone.removeTextChangedListener(phoneFormatter);
337339
subscriptions.unsubscribe();
340+
phone.removeTextChangedListener(phoneFormatter);
338341
}
339342

340343
/**

app/src/main/java/com/rockthevote/grommet/ui/registration/AssistantInfoFragment.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,11 @@ public void onViewCreated(View view, Bundle savedInstanceState) {
8686
@Override
8787
public void onResume() {
8888
super.onResume();
89-
phoneFormatter = new PhoneNumberFormattingTextWatcher();
89+
subscriptions = new CompositeSubscription();
90+
91+
phoneFormatter = new PhoneNumberFormattingTextWatcher("en");
9092
phoneEditText.addTextChangedListener(phoneFormatter);
9193

92-
subscriptions = new CompositeSubscription();
9394
subscriptions.add(RxTextView.afterTextChangeEvents(phoneEditText)
9495
.observeOn(Schedulers.io())
9596
.debounce(DEBOUNCE, TimeUnit.MILLISECONDS)
@@ -107,8 +108,8 @@ public void onResume() {
107108
@Override
108109
public void onPause() {
109110
super.onPause();
110-
phoneEditText.removeTextChangedListener(phoneFormatter);
111111
subscriptions.unsubscribe();
112+
phoneEditText.removeTextChangedListener(phoneFormatter);
112113
}
113114

114115
@OnCheckedChanged(R.id.checkbox_has_assistant)

app/src/main/java/com/rockthevote/grommet/ui/registration/RegistrationActivity.java

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
import android.support.design.widget.AppBarLayout;
66
import android.support.v4.view.ViewPager;
77
import android.support.v7.widget.Toolbar;
8+
import android.transition.Slide;
89
import android.view.Menu;
910
import android.view.MenuItem;
1011
import android.view.View;
1112
import android.view.ViewGroup;
13+
import android.view.Window;
1214
import android.widget.Button;
1315
import android.widget.LinearLayout;
1416

@@ -61,6 +63,11 @@ public RegistrationActivity() {
6163

6264
@Override
6365
protected void onCreate(Bundle savedInstanceState) {
66+
// inside your activity (if you did not enable transitions in your theme)
67+
getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
68+
getWindow().setExitTransition(new Slide());
69+
getWindow().setEnterTransition(new Slide());
70+
6471
super.onCreate(savedInstanceState);
6572

6673
ViewGroup contentView = getContentView();
@@ -123,12 +130,16 @@ public boolean onOptionsItemSelected(MenuItem item) {
123130
showCancelDialog();
124131
return true;
125132
case R.id.action_english:
126-
LocaleUtils.setLocale(new Locale("en"));
127-
recreate();
133+
if (!Locale.getDefault().equals(new Locale("en"))) {
134+
LocaleUtils.setLocale(new Locale("en"));
135+
recreate();
136+
}
128137
return true;
129138
case R.id.action_espanol:
130-
LocaleUtils.setLocale(new Locale("es"));
131-
recreate();
139+
if (!Locale.getDefault().equals(new Locale("es"))) {
140+
LocaleUtils.setLocale(new Locale("es"));
141+
recreate();
142+
}
132143
return true;
133144
default:
134145
return super.onOptionsItemSelected(item);

0 commit comments

Comments
 (0)