|
30 | 30 | import android.view.LayoutInflater; |
31 | 31 | import android.view.View; |
32 | 32 | import android.view.ViewGroup; |
| 33 | +import android.view.animation.Animation; |
| 34 | +import android.view.animation.AnimationUtils; |
33 | 35 |
|
34 | 36 | import com.nextcloud.client.account.User; |
35 | 37 | import com.nextcloud.client.account.UserAccountManager; |
@@ -158,21 +160,32 @@ public void onCreate(@Nullable Bundle savedInstanceState) { |
158 | 160 | shareRepository.refreshSharesForFile(file.getRemotePath(), () -> { |
159 | 161 | refreshCapabilitiesFromDB(); |
160 | 162 | refreshSharesFromDB(); |
161 | | - binding.shimmerLayout.setVisibility(View.GONE); |
162 | | - binding.shareContainer.setVisibility(View.VISIBLE); |
| 163 | + showShareContainer(); |
163 | 164 | return Unit.INSTANCE; |
164 | 165 | }, () -> { |
165 | | - binding.shimmerLayout.setVisibility(View.GONE); |
166 | | - binding.shareContainer.setVisibility(View.VISIBLE); |
| 166 | + showShareContainer(); |
167 | 167 | DisplayUtils.showSnackMessage(getView(), R.string.error_fetching_sharees); |
168 | 168 | return Unit.INSTANCE; |
169 | 169 | }); |
170 | 170 | } |
171 | 171 |
|
| 172 | + private void showShareContainer() { |
| 173 | + if (binding == null) { |
| 174 | + return; |
| 175 | + } |
| 176 | + |
| 177 | + binding.shimmerLayout.clearAnimation(); |
| 178 | + binding.shimmerLayout.setVisibility(View.GONE); |
| 179 | + binding.shareContainer.setVisibility(View.VISIBLE); |
| 180 | + } |
| 181 | + |
172 | 182 | @Override |
173 | 183 | public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { |
174 | 184 | binding = FileDetailsSharingFragmentBinding.inflate(inflater, container, false); |
175 | 185 |
|
| 186 | + final Animation blinkAnimation = AnimationUtils.loadAnimation(requireContext(), R.anim.blink); |
| 187 | + binding.shimmerLayout.startAnimation(blinkAnimation); |
| 188 | + |
176 | 189 | fileOperationsHelper = fileActivity.getFileOperationsHelper(); |
177 | 190 |
|
178 | 191 | AccountManager accountManager = AccountManager.get(requireContext()); |
|
0 commit comments