From f44985dbf79859a96fdcf69f64593489c831c713 Mon Sep 17 00:00:00 2001 From: TheScarastic Date: Thu, 7 Apr 2022 10:43:48 +0530 Subject: [PATCH] eDrive: Only show aliases when aliases are present --- .../e/drive/widgets/EDriveWidget.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/foundation/e/drive/widgets/EDriveWidget.java b/app/src/main/java/foundation/e/drive/widgets/EDriveWidget.java index 68ad65ee..25daf2ad 100644 --- a/app/src/main/java/foundation/e/drive/widgets/EDriveWidget.java +++ b/app/src/main/java/foundation/e/drive/widgets/EDriveWidget.java @@ -63,7 +63,7 @@ public class EDriveWidget extends AppWidgetProvider { private final SimpleDateFormat sdf = new SimpleDateFormat("HH:mm", Locale.getDefault()); private final GetRemoteUserInfoOperation getRemoteUserInfoOperation = new GetRemoteUserInfoOperation(); private final GetAliasOperation getAliasOperation = new GetAliasOperation(); - private ArrayList aliases; + private ArrayList aliases = new ArrayList<>(); private UserInfo userInfo = null; private RemoteViews views = null; @@ -221,7 +221,7 @@ public class EDriveWidget extends AppWidgetProvider { views.setTextViewText(R.id.sync, context.getString(R.string.last_synced, sdf.format(calender.getTime()))); - if (aliases == null || aliases.isEmpty()) { + if (aliases.isEmpty()) { views.setViewVisibility(R.id.show_alias, View.GONE); views.setViewVisibility(R.id.alias1_container, View.GONE); views.setViewVisibility(R.id.hide_alias, View.GONE); @@ -233,16 +233,16 @@ public class EDriveWidget extends AppWidgetProvider { null)); views.setOnClickPendingIntent(R.id.alias1_clipboard, getPendingSelfIntent(context, COPY_ALIAS, String.valueOf(aliases.get(0)))); - } - if (showAlias) { - views.setViewVisibility(R.id.show_alias, View.GONE); - views.setViewVisibility(R.id.hide_alias, View.VISIBLE); - views.setViewVisibility(R.id.alias1_container, View.VISIBLE); - } else { - views.setViewVisibility(R.id.show_alias, View.VISIBLE); - views.setViewVisibility(R.id.hide_alias, View.GONE); - views.setViewVisibility(R.id.alias1_container, View.GONE); + if (showAlias) { + views.setViewVisibility(R.id.show_alias, View.GONE); + views.setViewVisibility(R.id.hide_alias, View.VISIBLE); + views.setViewVisibility(R.id.alias1_container, View.VISIBLE); + } else { + views.setViewVisibility(R.id.show_alias, View.VISIBLE); + views.setViewVisibility(R.id.hide_alias, View.GONE); + views.setViewVisibility(R.id.alias1_container, View.GONE); + } } final PendingIntent pendingIntentSettings = PendingIntent.getActivity(context, 0, -- GitLab