Skip to content

Commit

Permalink
Merge pull request #26 from binsheng/master
Browse files Browse the repository at this point in the history
fix ProgressBar didn’t hide when host error in SignInActivity use custom host.
  • Loading branch information
xingstarx authored Apr 6, 2017
2 parents 5d43387 + 4e8ae67 commit 5d20a2e
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions app/src/main/java/org/houxg/leamonax/ui/SignInActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,18 @@ public class SignInActivity extends BaseActivity implements TextWatcher {
@BindView(R.id.tv_example)
TextView mExampleTv;

/**
* @param data
* @return account local id or -1
*/
public static long getAccountIdFromData(Intent data) {
if (data == null) {
return -1;
} else {
return data.getLongExtra(EXTRA_ACCOUNT_LOCAL_ID, -1);
}
}

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand Down Expand Up @@ -211,8 +223,8 @@ public void onError(Throwable e) {
ToastUtils.show(SignInActivity.this, R.string.illegal_host);
} else {
ToastUtils.showNetworkError(SignInActivity.this);
animateFinish(mSignInBtn, mSignInProgress);
}
animateFinish(mSignInBtn, mSignInProgress);
}

@Override
Expand Down Expand Up @@ -299,19 +311,6 @@ private void handleAuthResponse(Authentication authentication, String host) {
}
}

/**
*
* @param data
* @return account local id or -1
*/
public static long getAccountIdFromData(Intent data) {
if (data == null) {
return -1;
} else {
return data.getLongExtra(EXTRA_ACCOUNT_LOCAL_ID, -1);
}
}

private Observable<String> initHost() {
return Observable.create(new Observable.OnSubscribe<String>() {
@Override
Expand All @@ -330,9 +329,6 @@ public void call(Subscriber<? super String> subscriber) {
});
}

private static class IllegalHostException extends Exception {
}

private void animateProgress(View button, final View progressBar) {
button.animate()
.scaleX(0)
Expand Down Expand Up @@ -385,4 +381,7 @@ public void afterTextChanged(Editable s) {
String password = mPasswordEt.getText().toString();
mSignInBtn.setEnabled(!TextUtils.isEmpty(email) && !TextUtils.isEmpty(password));
}

private static class IllegalHostException extends Exception {
}
}

0 comments on commit 5d20a2e

Please sign in to comment.