Fix #2163: Hide subtitle message when uploading a single image (#2169)

* Hide subtitle message when uploading a single image (#2163)

* updateSubtitleVisibility: Javadoc and replace if with ternary operator

* updateSubtitleVisibility: change findViewById to BindView

* Remove null checks for views

Null check is not required while binding views with butterknife.
This commit is contained in:
Zhao Gang 2019-01-01 18:38:12 +08:00 committed by Vivek Maskara
parent 5c8a0cdd93
commit af291a5fcc
5 changed files with 18 additions and 2 deletions

View file

@ -93,6 +93,8 @@ public class UploadActivity extends AuthenticatedActivity implements UploadView,
@BindView(R.id.bottom_card_next) Button next;
@BindView(R.id.bottom_card_previous) Button previous;
@BindView(R.id.bottom_card_add_desc) Button bottomCardAddDescription;
@BindView(R.id.categories_subtitle) TextView categoriesSubtitle;
@BindView(R.id.license_subtitle) TextView licenseSubtitle;
//Right Card
@BindView(R.id.right_card) CardView rightCard;
@ -322,6 +324,16 @@ public class UploadActivity extends AuthenticatedActivity implements UploadView,
}
}
/**
* Only show the subtitle ("For all images in set") if multiple images being uploaded
* @param imageCount Number of images being uploaded
*/
@Override
public void updateSubtitleVisibility(int imageCount) {
categoriesSubtitle.setVisibility(imageCount > 1 ? View.VISIBLE : View.GONE);
licenseSubtitle.setVisibility(imageCount > 1 ? View.VISIBLE : View.GONE);
}
@Override
public void setBottomCardState(boolean state) {
updateCardState(state, bottomCardExpandButton, rvDescriptions, previous, next, bottomCardAddDescription);

View file

@ -385,6 +385,8 @@ public class UploadPresenter {
GPSExtractor gpsObj = uploadModel.getCurrentItem().gpsCoords;
view.updateRightCardContent(gpsObj != null && gpsObj.imageCoordsExists);
view.updateSubtitleVisibility(uploadModel.getCount());
showCorrectCards(uploadModel.getCurrentStep(), uploadModel.getCount());
}

View file

@ -64,6 +64,8 @@ public interface UploadView {
void updateTopCardContent();
void updateSubtitleVisibility(int imageCount);
void dismissKeyboard();
void showBadPicturePopup(@ImageUtils.Result int errorMessage);

View file

@ -38,7 +38,7 @@
android:textSize="@dimen/subtitle_text"
android:text="@string/upload_flow_all_images_in_set"
android:layout_below="@+id/categories_title"
tools:text="(For all images in set)" />
android:visibility="gone" />
<FrameLayout
android:layout_width="match_parent"

View file

@ -38,7 +38,7 @@
android:textSize="@dimen/subtitle_text"
android:text="@string/upload_flow_all_images_in_set"
android:layout_below="@+id/license_title"
tools:text="(For all images in set)" />
android:visibility="gone" />
<Spinner
android:id="@+id/license_list"