diff --git a/app/AndroidManifest.xml b/app/AndroidManifest.xml index 00242b4..867d454 100644 --- a/app/AndroidManifest.xml +++ b/app/AndroidManifest.xml @@ -34,7 +34,7 @@ - @@ -53,7 +53,7 @@ - com.googlecode.androidannotations + org.androidannotations androidannotations ${androidannotations.version} provided - com.googlecode.androidannotations + org.androidannotations androidannotations-api ${androidannotations.version} @@ -58,11 +58,6 @@ ${dagger.version} true - - com.jakewharton - butterknife - 1.3.2 - com.actionbarsherlock actionbarsherlock diff --git a/app/src/main/java/com/donnfelker/android/bootstrap/BootstrapModule.java b/app/src/main/java/com/donnfelker/android/bootstrap/BootstrapModule.java index a97a023..0902009 100644 --- a/app/src/main/java/com/donnfelker/android/bootstrap/BootstrapModule.java +++ b/app/src/main/java/com/donnfelker/android/bootstrap/BootstrapModule.java @@ -2,7 +2,7 @@ import android.accounts.AccountManager; import android.content.Context; -import com.donnfelker.android.bootstrap.authenticator.BootstrapAuthenticatorActivity; +import com.donnfelker.android.bootstrap.authenticator.BootstrapAuthenticatorActivity_; import com.donnfelker.android.bootstrap.authenticator.LogoutService; import com.donnfelker.android.bootstrap.core.TimerService; import com.donnfelker.android.bootstrap.ui.*; @@ -22,9 +22,9 @@ injects = { BootstrapApplication.class, - BootstrapAuthenticatorActivity.class, + BootstrapAuthenticatorActivity_.class, CarouselActivity_.class, - BootstrapTimerActivity.class, + BootstrapTimerActivity_.class, CheckInsListFragment.class, NewsActivity_.class, NewsListFragment.class, diff --git a/app/src/main/java/com/donnfelker/android/bootstrap/authenticator/BootstrapAuthenticatorActivity.java b/app/src/main/java/com/donnfelker/android/bootstrap/authenticator/BootstrapAuthenticatorActivity.java index 34e3bee..d0037dc 100644 --- a/app/src/main/java/com/donnfelker/android/bootstrap/authenticator/BootstrapAuthenticatorActivity.java +++ b/app/src/main/java/com/donnfelker/android/bootstrap/authenticator/BootstrapAuthenticatorActivity.java @@ -27,7 +27,6 @@ import android.text.Html; import android.text.TextWatcher; import android.text.method.LinkMovementMethod; -import android.util.Log; import android.view.KeyEvent; import android.view.View; import android.view.View.OnKeyListener; @@ -45,25 +44,22 @@ import com.donnfelker.android.bootstrap.util.Strings; import com.github.kevinsawicki.http.HttpRequest; import com.github.kevinsawicki.wishlist.Toaster; -import com.donnfelker.android.bootstrap.R.id; import com.donnfelker.android.bootstrap.R.layout; import com.donnfelker.android.bootstrap.R.string; import com.donnfelker.android.bootstrap.ui.TextWatcherAdapter; import com.google.gson.Gson; -import java.net.URLEncoder; import java.util.ArrayList; import java.util.List; -import butterknife.InjectView; -import butterknife.Views; - -import static com.donnfelker.android.bootstrap.core.Constants.Http.USERNAME; -import static com.donnfelker.android.bootstrap.core.Constants.Http.PASSWORD; +import org.androidannotations.annotations.AfterViews; +import org.androidannotations.annotations.EActivity; +import org.androidannotations.annotations.ViewById; /** * Activity to authenticate the user against an API (example API on Parse.com) */ +@EActivity(layout.login_activity) public class BootstrapAuthenticatorActivity extends SherlockAccountAuthenticatorActivity { /** @@ -89,9 +85,10 @@ public class BootstrapAuthenticatorActivity extends SherlockAccountAuthenticator private AccountManager accountManager; - @InjectView(id.et_email) AutoCompleteTextView emailText; - @InjectView(id.et_password) EditText passwordText; - @InjectView(id.b_signin) Button signinButton; + @ViewById AutoCompleteTextView et_email; + @ViewById EditText et_password; + @ViewById Button b_signin; + @ViewById TextView tv_signup; private TextWatcher watcher = validationTextWatcher(); @@ -133,44 +130,42 @@ public void onCreate(Bundle bundle) { requestNewAccount = email == null; confirmCredentials = intent.getBooleanExtra(PARAM_CONFIRMCREDENTIALS, false); + } - setContentView(layout.login_activity); - - Views.inject(this); - emailText.setAdapter(new ArrayAdapter(this, + @AfterViews + protected void configureAdapter(){ + et_email.setAdapter(new ArrayAdapter(this, simple_dropdown_item_1line, userEmailAccounts())); - passwordText.setOnKeyListener(new OnKeyListener() { + et_password.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { if (event != null && ACTION_DOWN == event.getAction() - && keyCode == KEYCODE_ENTER && signinButton.isEnabled()) { - handleLogin(signinButton); + && keyCode == KEYCODE_ENTER && b_signin.isEnabled()) { + handleLogin(b_signin); return true; } return false; } }); - passwordText.setOnEditorActionListener(new OnEditorActionListener() { + et_password.setOnEditorActionListener(new OnEditorActionListener() { public boolean onEditorAction(TextView v, int actionId, - KeyEvent event) { - if (actionId == IME_ACTION_DONE && signinButton.isEnabled()) { - handleLogin(signinButton); + KeyEvent event) { + if (actionId == IME_ACTION_DONE && b_signin.isEnabled()) { + handleLogin(b_signin); return true; } return false; } }); - emailText.addTextChangedListener(watcher); - passwordText.addTextChangedListener(watcher); - - TextView signupText = (TextView) findViewById(id.tv_signup); - signupText.setMovementMethod(LinkMovementMethod.getInstance()); - signupText.setText(Html.fromHtml(getString(string.signup_link))); + et_email.addTextChangedListener(watcher); + et_password.addTextChangedListener(watcher); + tv_signup.setMovementMethod(LinkMovementMethod.getInstance()); + tv_signup.setText(Html.fromHtml(getString(string.signup_link))); } private List userEmailAccounts() { @@ -197,8 +192,8 @@ protected void onResume() { } private void updateUIWithValidation() { - boolean populated = populated(emailText) && populated(passwordText); - signinButton.setEnabled(populated); + boolean populated = populated(et_email) && populated(et_password); + b_signin.setEnabled(populated); } private boolean populated(EditText editText) { @@ -233,8 +228,8 @@ public void handleLogin(View view) { return; if (requestNewAccount) - email = emailText.getText().toString(); - password = passwordText.getText().toString(); + email = et_email.getText().toString(); + password = et_password.getText().toString(); showProgress(); authenticationTask = new SafeAsyncTask() { diff --git a/app/src/main/java/com/donnfelker/android/bootstrap/ui/BootstrapActivity.java b/app/src/main/java/com/donnfelker/android/bootstrap/ui/BootstrapActivity.java index 479b401..fed2dcf 100644 --- a/app/src/main/java/com/donnfelker/android/bootstrap/ui/BootstrapActivity.java +++ b/app/src/main/java/com/donnfelker/android/bootstrap/ui/BootstrapActivity.java @@ -5,8 +5,8 @@ import com.actionbarsherlock.app.SherlockActivity; import com.actionbarsherlock.view.MenuItem; import com.donnfelker.android.bootstrap.BootstrapApplication; -import com.googlecode.androidannotations.annotations.EActivity; -import com.googlecode.androidannotations.annotations.OptionsItem; +import org.androidannotations.annotations.EActivity; +import org.androidannotations.annotations.OptionsItem; import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP; import static android.content.Intent.FLAG_ACTIVITY_SINGLE_TOP; diff --git a/app/src/main/java/com/donnfelker/android/bootstrap/ui/BootstrapTimerActivity.java b/app/src/main/java/com/donnfelker/android/bootstrap/ui/BootstrapTimerActivity.java index 5d2ec63..04f0393 100644 --- a/app/src/main/java/com/donnfelker/android/bootstrap/ui/BootstrapTimerActivity.java +++ b/app/src/main/java/com/donnfelker/android/bootstrap/ui/BootstrapTimerActivity.java @@ -18,35 +18,28 @@ import com.donnfelker.android.bootstrap.core.TimerTickEvent; import javax.inject.Inject; -import com.googlecode.androidannotations.annotations.EActivity; +import org.androidannotations.annotations.Click; +import org.androidannotations.annotations.EActivity; +import org.androidannotations.annotations.ViewById; import com.squareup.otto.Bus; import com.squareup.otto.Subscribe; -import butterknife.InjectView; -import butterknife.Views; - @EActivity(R.layout.bootstrap_timer) -public class BootstrapTimerActivity extends BootstrapFragmentActivity implements View.OnClickListener { +public class BootstrapTimerActivity extends BootstrapFragmentActivity { @Inject Bus BUS; - @InjectView(R.id.chronometer) protected TextView chronometer; - @InjectView(R.id.start) protected Button start; - @InjectView(R.id.stop) protected Button stop; - @InjectView(R.id.pause) protected Button pause; - @InjectView(R.id.resume) protected Button resume; + @ViewById protected TextView chronometer; + @ViewById protected Button start; + @ViewById protected Button stop; + @ViewById protected Button pause; + @ViewById protected Button resume; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setTitle(R.string.timer); - - start.setOnClickListener(this); - stop.setOnClickListener(this); - pause.setOnClickListener(this); - resume.setOnClickListener(this); - } @Override @@ -63,28 +56,12 @@ protected void onPause() { BUS.unregister(this); } - @Override - public void onClick(View v) { - switch(v.getId()) { - case R.id.start: - startTimer(); - break; - case R.id.stop: - produceStopEvent(); - break; - case R.id.pause: - producePauseEvent(); - break; - case R.id.resume: - produceResumeEvent(); - break; - } - } /** * Starts the timer service */ - private void startTimer() { + @Click + void startClicked(){ if(isTimerServiceRunning() == false) { final Intent i = new Intent(this, TimerService.class); startService(i); @@ -98,24 +75,31 @@ private void startTimer() { /** * Posts a {@link StopTimerEvent} message to the {@link Bus} */ - private void produceStopEvent() { + @Click + void stopClicked(){ BUS.post(new StopTimerEvent()); } /** * Posts a {@link PauseTimerEvent} message to the {@link Bus} */ - private void producePauseEvent() { + @Click + void pauseClicked(){ BUS.post(new PauseTimerEvent()); } /** * Posts a {@link ResumeTimerEvent} message to the {@link Bus} */ - private void produceResumeEvent() { + @Click + void resumeClicked(){ BUS.post(new ResumeTimerEvent()); } + private void produceResumeEvent() { + + } + @Subscribe public void onTimerPausedEvent(TimerPausedEvent event) { if(event.isTimerIsPaused()) { diff --git a/app/src/main/java/com/donnfelker/android/bootstrap/ui/CarouselActivity.java b/app/src/main/java/com/donnfelker/android/bootstrap/ui/CarouselActivity.java index 6c9f05e..d4fc589 100644 --- a/app/src/main/java/com/donnfelker/android/bootstrap/ui/CarouselActivity.java +++ b/app/src/main/java/com/donnfelker/android/bootstrap/ui/CarouselActivity.java @@ -11,10 +11,10 @@ import com.donnfelker.android.bootstrap.R; import com.donnfelker.android.bootstrap.R.id; -import com.googlecode.androidannotations.annotations.AfterViews; -import com.googlecode.androidannotations.annotations.EActivity; -import com.googlecode.androidannotations.annotations.OptionsItem; -import com.googlecode.androidannotations.annotations.ViewById; +import org.androidannotations.annotations.AfterViews; +import org.androidannotations.annotations.EActivity; +import org.androidannotations.annotations.OptionsItem; +import org.androidannotations.annotations.ViewById; import com.viewpagerindicator.TitlePageIndicator; /** @@ -44,7 +44,7 @@ protected void configureAdapter(){ @OptionsItem boolean timerSelected() { - final Intent i = new Intent(this, BootstrapTimerActivity.class); + final Intent i = new Intent(this, BootstrapTimerActivity_.class); startActivity(i); return true; } diff --git a/app/src/main/java/com/donnfelker/android/bootstrap/ui/NewsActivity.java b/app/src/main/java/com/donnfelker/android/bootstrap/ui/NewsActivity.java index 911b1e4..99f597a 100644 --- a/app/src/main/java/com/donnfelker/android/bootstrap/ui/NewsActivity.java +++ b/app/src/main/java/com/donnfelker/android/bootstrap/ui/NewsActivity.java @@ -7,9 +7,9 @@ import com.donnfelker.android.bootstrap.R; import com.donnfelker.android.bootstrap.core.News; -import com.googlecode.androidannotations.annotations.AfterViews; -import com.googlecode.androidannotations.annotations.EActivity; -import com.googlecode.androidannotations.annotations.ViewById; +import org.androidannotations.annotations.AfterViews; +import org.androidannotations.annotations.EActivity; +import org.androidannotations.annotations.ViewById; @EActivity(R.layout.news) public class NewsActivity extends BootstrapActivity { diff --git a/app/src/main/java/com/donnfelker/android/bootstrap/ui/UserActivity.java b/app/src/main/java/com/donnfelker/android/bootstrap/ui/UserActivity.java index 207d830..28cdcc4 100644 --- a/app/src/main/java/com/donnfelker/android/bootstrap/ui/UserActivity.java +++ b/app/src/main/java/com/donnfelker/android/bootstrap/ui/UserActivity.java @@ -11,9 +11,9 @@ import com.donnfelker.android.bootstrap.core.User; import javax.inject.Inject; -import com.googlecode.androidannotations.annotations.AfterViews; -import com.googlecode.androidannotations.annotations.EActivity; -import com.googlecode.androidannotations.annotations.ViewById; +import org.androidannotations.annotations.AfterViews; +import org.androidannotations.annotations.EActivity; +import org.androidannotations.annotations.ViewById; @EActivity(R.layout.user_view) public class UserActivity extends BootstrapActivity { diff --git a/integration-tests/src/main/java/com/donnfelker/android/bootstrap/test/BootstrapAuthenticatorTest.java b/integration-tests/src/main/java/com/donnfelker/android/bootstrap/test/BootstrapAuthenticatorTest.java index 684bd9e..9db06eb 100644 --- a/integration-tests/src/main/java/com/donnfelker/android/bootstrap/test/BootstrapAuthenticatorTest.java +++ b/integration-tests/src/main/java/com/donnfelker/android/bootstrap/test/BootstrapAuthenticatorTest.java @@ -8,18 +8,19 @@ import com.donnfelker.android.bootstrap.authenticator.BootstrapAuthenticatorActivity; import com.donnfelker.android.bootstrap.R; +import com.donnfelker.android.bootstrap.authenticator.BootstrapAuthenticatorActivity_; /** * Tests of displaying the authenticator activity */ -public class BootstrapAuthenticatorTest extends ActivityInstrumentationTestCase2 { +public class BootstrapAuthenticatorTest extends ActivityInstrumentationTestCase2 { /** * Create test for {@link com.donnfelker.android.bootstrap.authenticator.BootstrapAuthenticatorActivity} */ public BootstrapAuthenticatorTest() { - super(BootstrapAuthenticatorActivity.class); + super(BootstrapAuthenticatorActivity_.class); } /** diff --git a/integration-tests/src/main/java/com/donnfelker/android/bootstrap/test/CarouselTest.java b/integration-tests/src/main/java/com/donnfelker/android/bootstrap/test/CarouselTest.java index fe25d79..13c9a66 100644 --- a/integration-tests/src/main/java/com/donnfelker/android/bootstrap/test/CarouselTest.java +++ b/integration-tests/src/main/java/com/donnfelker/android/bootstrap/test/CarouselTest.java @@ -5,18 +5,19 @@ import android.test.ActivityInstrumentationTestCase2; import com.donnfelker.android.bootstrap.ui.CarouselActivity; +import com.donnfelker.android.bootstrap.ui.CarouselActivity_; /** * Test displaying of carousel. */ -public class CarouselTest extends ActivityInstrumentationTestCase2 { +public class CarouselTest extends ActivityInstrumentationTestCase2 { /** * Create test for {@link CarouselActivity} */ public CarouselTest() { - super(CarouselActivity.class); + super(CarouselActivity_.class); } /** diff --git a/integration-tests/src/main/java/com/donnfelker/android/bootstrap/test/NewsViewTest.java b/integration-tests/src/main/java/com/donnfelker/android/bootstrap/test/NewsViewTest.java index d0ee496..5fb193f 100644 --- a/integration-tests/src/main/java/com/donnfelker/android/bootstrap/test/NewsViewTest.java +++ b/integration-tests/src/main/java/com/donnfelker/android/bootstrap/test/NewsViewTest.java @@ -8,18 +8,19 @@ import com.donnfelker.android.bootstrap.core.News; import com.donnfelker.android.bootstrap.ui.CarouselActivity; +import com.donnfelker.android.bootstrap.ui.CarouselActivity_; /** * Tests for displaying a specific {@link News} item */ -public class NewsViewTest extends ActivityInstrumentationTestCase2 { +public class NewsViewTest extends ActivityInstrumentationTestCase2 { /** * Create test for {@link com.donnfelker.android.bootstrap.ui.CarouselActivity} */ public NewsViewTest() { - super(CarouselActivity.class); + super(CarouselActivity_.class); } /** diff --git a/pom.xml b/pom.xml index f204d56..b8791c6 100644 --- a/pom.xml +++ b/pom.xml @@ -54,7 +54,7 @@ com.jayway.maven.plugins.android.generation2 android-maven-plugin - 3.4.0 + 3.6.0 true