Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #107 from liferay/LMW-214-fix-ui-regressions
Browse files Browse the repository at this point in the history
LMW 214 Fix UI Regressions
  • Loading branch information
javiergamarra committed Mar 10, 2015
2 parents fc4a3e0 + bb11855 commit 2612e9d
Show file tree
Hide file tree
Showing 32 changed files with 277 additions and 167 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ protected ForgotPasswordInteractor createInteractor(String actionName) {

@Override
protected void onUserAction(String userActionName, ForgotPasswordInteractor interactor, Object... args) {
ForgotPasswordViewModel viewModel = (ForgotPasswordViewModel)getScreenletView();
ForgotPasswordViewModel viewModel = getViewModel();

viewModel.showStartOperation(userActionName);

String login = viewModel.getLogin();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,13 @@ protected LoginInteractor createInteractor(String actionName) {

@Override
protected void onUserAction(String userActionName, LoginInteractor interactor, Object... args) {
LoginViewModel loginViewModel = (LoginViewModel)getScreenletView();
loginViewModel.showStartOperation(userActionName);
LoginViewModel viewModel = getViewModel();

String login = loginViewModel.getLogin();
String password = loginViewModel.getPassword();
AuthMethod method = loginViewModel.getAuthMethod();
viewModel.showStartOperation(userActionName);

String login = viewModel.getLogin();
String password = viewModel.getPassword();
AuthMethod method = viewModel.getAuthMethod();

try {
interactor.login(login, password, method);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,10 @@ public void onSignUpSuccess(User user) {
}

if (_autoLogin) {
SignUpViewModel signUpViewModel = (SignUpViewModel)getScreenletView();
String emailAddress = signUpViewModel.getEmailAddress();
String password = signUpViewModel.getPassword();
SignUpViewModel viewModel = getViewModel();

String emailAddress = viewModel.getEmailAddress();
String password = viewModel.getPassword();

SessionContext.createSession(emailAddress, password);
SessionContext.setLoggedUser(user);
Expand All @@ -87,30 +88,6 @@ public void onSignUpSuccess(User user) {
}
}

public void onUserAction(String userActionName) {
SignUpViewModel signUpViewModel = (SignUpViewModel)getScreenletView();
signUpViewModel.showStartOperation(userActionName);

String firstName = signUpViewModel.getFirstName();
String middleName = signUpViewModel.getMiddleName();
String lastName = signUpViewModel.getLastName();
String emailAddress = signUpViewModel.getEmailAddress();
String password = signUpViewModel.getPassword();
String screenName = signUpViewModel.getScreenName();
String jobTitle = signUpViewModel.getJobTitle();
Locale locale = getResources().getConfiguration().locale;

try {
getInteractor().signUp(
_companyId, firstName, middleName, lastName, emailAddress,
screenName, password, jobTitle, locale, _anonymousApiUserName,
_anonymousApiPassword);
}
catch (Exception e) {
onSignUpFailure(e);
}
}

public String getAnonymousApiPassword() {
return _anonymousApiPassword;
}
Expand Down Expand Up @@ -204,15 +181,17 @@ protected SignUpInteractor createInteractor(String actionName) {

@Override
protected void onUserAction(String userActionName, SignUpInteractor interactor, Object... args) {
SignUpViewModel signUpViewModel = (SignUpViewModel)getScreenletView();

String firstName = signUpViewModel.getFirstName();
String middleName = signUpViewModel.getMiddleName();
String lastName = signUpViewModel.getLastName();
String emailAddress = signUpViewModel.getEmailAddress();
String password = signUpViewModel.getPassword();
String screenName = signUpViewModel.getScreenName();
String jobTitle = signUpViewModel.getJobTitle();
SignUpViewModel viewModel = getViewModel();

viewModel.showStartOperation(userActionName);

String firstName = viewModel.getFirstName();
String middleName = viewModel.getMiddleName();
String lastName = viewModel.getLastName();
String emailAddress = viewModel.getEmailAddress();
String password = viewModel.getPassword();
String screenName = viewModel.getScreenName();
String jobTitle = viewModel.getJobTitle();
Locale locale = getResources().getConfiguration().locale;

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@ public boolean validateForm() {
result &= isFieldValid;
}

DDLFormViewModel viewModel = (DDLFormViewModel) getScreenletView();
viewModel.showValidationResults(fieldResults, _autoScrollOnValidation);
getViewModel().showValidationResults(fieldResults, _autoScrollOnValidation);

return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,6 @@ public UserPortraitScreenlet(Context context, AttributeSet attributes, int defau
}

public void load() {
try {
if (_userId != 0) {
getInteractor().load(_userId);
}
else {
getInteractor().load(_male, _portraitId, _uuid);
}
}
catch (Exception e) {
onUserPortraitFailure(e);
}

performUserAction();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public void showStartOperation(String actionName, Object argument) {
}
else {
LiferayLogger.i("loading DDLForm");
showProgressBar();
showProgressBar(actionName);
}
}

Expand All @@ -142,7 +142,7 @@ public void showFinishOperation(String actionName) {

@Override
public void showFinishOperation(String actionName, Object argument) {
hideProgressBar();
hideProgressBar(actionName);
if (actionName.equals(DDLFormScreenlet.LOAD_FORM_ACTION)) {
LiferayLogger.i("loaded form");
Record record = (Record) argument;
Expand All @@ -168,7 +168,7 @@ public void showFailedOperation(String actionName, Exception e) {

@Override
public void showFailedOperation(String actionName, Exception e, Object argument) {
hideProgressBar();
hideProgressBar(actionName);
if (actionName.equals(DDLFormScreenlet.LOAD_FORM_ACTION)) {
LiferayLogger.e("error loading DDLForm", e);
DefaultCrouton.error(getContext(), getContext().getString(R.string.loading_form_error), e);
Expand Down Expand Up @@ -211,12 +211,22 @@ protected void clearFormFields() {
_submitButton.setVisibility(INVISIBLE);
}

protected void showProgressBar() {
_progressBar.setVisibility(VISIBLE);
protected void showProgressBar(String actionName) {
if (actionName.equals(DDLFormScreenlet.LOAD_FORM_ACTION)) {
_loadingFormProgressBar.setVisibility(VISIBLE);
}
else {
_progressBar.setVisibility(VISIBLE);
}
}

protected void hideProgressBar() {
_progressBar.setVisibility(INVISIBLE);
protected void hideProgressBar(String actionName) {
if (actionName.equals(DDLFormScreenlet.LOAD_FORM_ACTION)) {
_loadingFormProgressBar.setVisibility(INVISIBLE);
}
else {
_progressBar.setVisibility(INVISIBLE);
}
}

protected void showRecordValues() {
Expand Down Expand Up @@ -272,6 +282,7 @@ protected void onFinishInflate() {
_submitButton.setOnClickListener(this);

_progressBar = (ProgressBar) findViewById(R.id.ddlform_progress_bar);
_loadingFormProgressBar = (ProgressBar) findViewById(R.id.ddlform_loading_screen_progress_bar);
}

private DDLFieldViewModel findFieldView(Field field) {
Expand Down Expand Up @@ -300,6 +311,7 @@ private DDLFieldViewModel findFieldView(Field field) {
}

private ProgressBar _progressBar;
private ProgressBar _loadingFormProgressBar;
private ViewGroup _fieldsContainerView;
private Button _submitButton;
private Map<Field.EditorType, Integer> _layoutIds = new HashMap<>();
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@
style="@style/default_dialog_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/take_a_video"/>
android:text="@string/record_a_video"/>

<TextView
android:id="@+id/default_dialog_take_photo"
style="@style/default_dialog_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/make_a_photo"/>
android:text="@string/take_a_photo"/>

</LinearLayout>

Expand Down
34 changes: 25 additions & 9 deletions android/library/viewsets/src/main/res/layout/ddlform_default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,41 @@
android:id="@+id/ddlfields_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="10dp"
android:divider="@drawable/default_divider"
android:dividerPadding="10dp"
android:orientation="vertical"
android:layout_marginBottom="10dp"
android:showDividers="middle|end"/>

<ProgressBar
android:id="@+id/ddlform_progress_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/ddlform_loading_screen_progress_bar"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:visibility="invisible"/>

<Button
android:id="@+id/submit"
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="@string/submit"
android:visibility="gone"/>
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginBottom="30dp"
android:layout_marginTop="10dp">

<Button
android:id="@+id/submit"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/sign_in"
android:visibility="gone"/>

<ProgressBar
android:id="@+id/ddlform_progress_bar"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical|left"
android:theme="@style/white_theme"
android:visibility="invisible"/>
</FrameLayout>
</LinearLayout>
</com.liferay.mobile.screens.viewsets.defaultviews.ddl.form.DDLFormView>
36 changes: 26 additions & 10 deletions android/library/viewsets/src/main/res/layout/ddlform_material.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,36 @@
android:orientation="vertical"/>

<ProgressBar
android:id="@+id/ddlform_progress_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/ddlform_loading_screen_progress_bar"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:visibility="invisible"/>

<Button
android:id="@+id/submit"
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginTop="10dp"
android:text="@string/submit"
android:visibility="gone"/>
android:layout_marginBottom="20dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp">

<Button
android:id="@+id/submit"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:text="@string/sign_in"/>

<ProgressBar
android:id="@+id/ddlform_progress_bar"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical|left"
android:layout_margin="10dp"
android:elevation="10dp"
android:theme="@style/white_theme"
android:visibility="invisible"/>
</FrameLayout>

</LinearLayout>
</com.liferay.mobile.screens.viewsets.defaultviews.ddl.form.DDLFormView>
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@
<com.liferay.mobile.screens.base.ModalProgressBar
android:id="@+id/progress_bar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical|left"
android:theme="@style/white_theme"
android:visibility="invisible"
liferay:actionViewId="@id/sign_up_button"/>
</FrameLayout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@

<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:layout_marginTop="32dp">

<Button
android:id="@+id/sign_up_button"
Expand All @@ -58,9 +59,10 @@
<com.liferay.mobile.screens.base.ModalProgressBar
android:id="@+id/progress_bar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical|left"
android:layout_margin="10dp"
android:theme="@style/white_theme"
android:visibility="invisible"
liferay:actionViewId="@id/sign_up_button"/>
</FrameLayout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
<string name="required_value">Required value</string>
<string name="invalid">Invalid value</string>
<string name="open">Open:</string>
<string name="make_a_photo">Make a photo</string>
<string name="take_a_photo">Take a photo</string>
<string name="select_a_file">Select a file</string>
<string name="origin_of_file">Choose origin of file</string>
<string name="take_a_video">Take a video</string>
<string name="record_a_video">Record a video</string>
<string name="loading_form_error">Error loading DDLForm</string>
<string name="uploading_document_error">Error uploading document</string>
<string name="creating_file_error">Error creating file</string>
Expand Down
5 changes: 3 additions & 2 deletions android/samples/test-app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@

<application
android:allowBackup="true"
android:icon="@drawable/material_tinted_liferay_glyph"
android:label="@string/app_name">
android:icon="@drawable/liferay_icon"
android:label="@string/app_name"
android:theme="@style/Theme.AppCompat.Light">

<activity android:name=".MainActivity">

Expand Down
Loading

0 comments on commit 2612e9d

Please sign in to comment.