forked from github/wulkanowy-mirror
Hide actionbar during login (#79)
This commit is contained in:
parent
c72e7748e2
commit
cb6afb137f
@ -7,6 +7,7 @@ import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.design.widget.TextInputLayout;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.ArrayAdapter;
|
||||
@ -209,6 +210,18 @@ public class LoginActivity extends BaseActivity implements LoginContract.View {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showActionBar(boolean show) {
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
if (show) {
|
||||
actionBar.show();
|
||||
} else {
|
||||
actionBar.hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
@ -33,6 +33,8 @@ public interface LoginContract {
|
||||
|
||||
void hideSoftInput();
|
||||
|
||||
void showActionBar(boolean show);
|
||||
|
||||
}
|
||||
|
||||
@PerActivity
|
||||
|
@ -55,6 +55,7 @@ public class LoginPresenter extends BasePresenter<LoginContract.View>
|
||||
@Override
|
||||
public void onStartAsync() {
|
||||
if (isViewAttached()) {
|
||||
getView().showActionBar(false);
|
||||
getView().showLoginProgress(true);
|
||||
}
|
||||
}
|
||||
@ -84,24 +85,25 @@ public class LoginPresenter extends BasePresenter<LoginContract.View>
|
||||
public void onEndAsync(boolean success, Exception exception) {
|
||||
if (success) {
|
||||
getView().openMainActivity();
|
||||
return;
|
||||
} else if (exception instanceof BadCredentialsException) {
|
||||
getView().setErrorPassIncorrect();
|
||||
getView().showSoftInput();
|
||||
getView().showLoginProgress(false);
|
||||
} else if (exception instanceof AccountPermissionException) {
|
||||
getView().setErrorSymbolRequired();
|
||||
getView().showSoftInput();
|
||||
getView().showLoginProgress(false);
|
||||
} else {
|
||||
getView().onError(getRepository().getErrorLoginMessage(exception));
|
||||
getView().showLoginProgress(false);
|
||||
}
|
||||
|
||||
getView().showActionBar(true);
|
||||
getView().showLoginProgress(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCanceledAsync() {
|
||||
if (isViewAttached()) {
|
||||
getView().showActionBar(true);
|
||||
getView().showLoginProgress(false);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user