Search in sources :

Example 1 with FontButton

use of org.hisp.dhis.client.sdk.ui.views.FontButton in project pictureapp by EyeSeeTea.

the class LoginActivityStrategy method addDemoButton.

private void addDemoButton() {
    final ViewGroup loginViewsContainer = (ViewGroup) loginActivity.findViewById(R.id.login_dynamic_views_container);
    loginActivity.getLayoutInflater().inflate(R.layout.demo_login_button, loginViewsContainer, true);
    FontButton demoButton = (FontButton) loginActivity.findViewById(R.id.demo_login_button);
    demoButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Credentials demoCrededentials = Credentials.createDemoCredentials();
            loginActivity.showProgressBar();
            loginActivity.mLoginUseCase.execute(demoCrededentials, new ALoginUseCase.Callback() {

                @Override
                public void onLoginSuccess() {
                    executePullDemo();
                }

                @Override
                public void onServerURLNotValid() {
                    Log.e(this.getClass().getSimpleName(), "Server url not valid");
                }

                @Override
                public void onInvalidCredentials() {
                    Log.e(this.getClass().getSimpleName(), "Invalid credentials");
                }

                @Override
                public void onNetworkError() {
                    Log.e(this.getClass().getSimpleName(), "Network Error");
                }

                @Override
                public void onConfigJsonInvalid() {
                    Log.d(TAG, "onConfigJsonInvalid");
                }

                @Override
                public void onUnexpectedError() {
                    Log.e(this.getClass().getSimpleName(), "Config Json file not found");
                }

                @Override
                public void onMaxLoginAttemptsReachedError() {
                    Log.d(TAG, "onMaxLoginAttemptsReachedError");
                }
            });
        }
    });
}
Also used : ViewGroup(android.view.ViewGroup) FontButton(org.hisp.dhis.client.sdk.ui.views.FontButton) View(android.view.View) Credentials(org.eyeseetea.malariacare.domain.entity.Credentials)

Aggregations

View (android.view.View)1 ViewGroup (android.view.ViewGroup)1 Credentials (org.eyeseetea.malariacare.domain.entity.Credentials)1 FontButton (org.hisp.dhis.client.sdk.ui.views.FontButton)1