added loading icon while video is getting fetched
This commit is contained in:
@@ -129,7 +129,7 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall
|
||||
public void fetchExerciseAsync(Exercise.ExerciseFetchHandler onSuccessfulFetch, Exercise.ExerciseFetchHandler onFailedFetch) {
|
||||
// For some stupid reason we cannot perform network operations on the main thread.
|
||||
// therefore we'll have to do it like this...
|
||||
(new Thread(() -> {
|
||||
new Thread(() -> {
|
||||
Exercise exercise = ExerciseManager.fetchExerciseFromDatabase();
|
||||
if (exercise == null) {
|
||||
onFailedFetch.handle(null);
|
||||
@@ -141,6 +141,8 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall
|
||||
// exerciseDescriptionTextView.setText(exercise.description);
|
||||
exerciseVideoUrl = exercise.videoUrl;
|
||||
|
||||
findViewById(R.id.loadingPanel).setVisibility(View.GONE);
|
||||
|
||||
// Play the video
|
||||
VideoView videoView = findViewById(R.id.videoView);
|
||||
playVideo(videoView, this);
|
||||
@@ -156,7 +158,7 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall
|
||||
});
|
||||
});
|
||||
}
|
||||
})).start();
|
||||
}).start();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -30,6 +30,18 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/loadingPanel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center" >
|
||||
|
||||
<ProgressBar
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:indeterminate="true" />
|
||||
</RelativeLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/infoButtonFitness"
|
||||
android:layout_width="50dp"
|
||||
|
Reference in New Issue
Block a user