4545import fr .free .nrw .commons .ui .widget .CompatTextView ;
4646import timber .log .Timber ;
4747
48+ import static android .view .View .*;
4849import static android .widget .Toast .LENGTH_SHORT ;
4950
5051public class MediaDetailFragment extends CommonsDaggerSupportFragment {
@@ -154,9 +155,9 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
154155 authorLayout = (LinearLayout ) view .findViewById (R .id .authorLinearLayout );
155156
156157 if (isFeaturedMedia ){
157- authorLayout .setVisibility (View . VISIBLE );
158+ authorLayout .setVisibility (VISIBLE );
158159 } else {
159- authorLayout .setVisibility (View . GONE );
160+ authorLayout .setVisibility (GONE );
160161 }
161162
162163 licenseList = new LicenseList (getActivity ());
@@ -306,6 +307,12 @@ private void setTextFields(Media media) {
306307 }
307308 rebuildCatList ();
308309
310+ if (media .getCreator () == null || media .getCreator ().equals ("" )) {
311+ authorLayout .setVisibility (GONE );
312+ } else {
313+ author .setText (media .getCreator ());
314+ }
315+
309316 checkDeletion (media );
310317 }
311318
@@ -319,7 +326,7 @@ private void setOnClickListeners(final Media media) {
319326 if (media .getCoordinates () != null ) {
320327 coordinates .setOnClickListener (v -> openMap (media .getCoordinates ()));
321328 }
322- if (delete .getVisibility () == View . VISIBLE ) {
329+ if (delete .getVisibility () == VISIBLE ) {
323330 enableDeleteButton (true );
324331
325332 delete .setOnClickListener (v -> {
@@ -369,7 +376,7 @@ public void onTextChanged(CharSequence s, int start, int before, int count) {
369376 d .getButton (AlertDialog .BUTTON_POSITIVE ).setEnabled (false );
370377 });
371378 }
372- if (nominatedforDeletion .getVisibility () == View . VISIBLE ){
379+ if (nominatedforDeletion .getVisibility () == VISIBLE ){
373380 seeMore .setOnClickListener (v -> {
374381 openWebBrowser (media .getFilePageTitle ().getMobileUri ().toString ());
375382 });
@@ -476,12 +483,12 @@ private String prettyCoordinates(Media media) {
476483
477484 private void checkDeletion (Media media ){
478485 if (media .getRequestedDeletion ()){
479- delete .setVisibility (View . GONE );
480- nominatedforDeletion .setVisibility (View . VISIBLE );
486+ delete .setVisibility (GONE );
487+ nominatedforDeletion .setVisibility (VISIBLE );
481488 }
482489 else {
483- delete .setVisibility (View . VISIBLE );
484- nominatedforDeletion .setVisibility (View . GONE );
490+ delete .setVisibility (VISIBLE );
491+ nominatedforDeletion .setVisibility (GONE );
485492 }
486493 }
487494
0 commit comments