Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Commit

Permalink
fix: Release 5.0.0 App Navigation Issues (#1826)
Browse files Browse the repository at this point in the history
fix: Release 5.0.0 app navigation issues

- Facebook Authentication
- Register screen error layout
- Highlighted fields of Course Dashboard
- WebView scrolling issue within CoordinatorLayout
- Introduce NestedScrollWebView to resolve scrolling problems when using WebView within a CoordinatorLayout.
- Organisation name visibility on expended toolbar on CourseDashboard
- Shift date snackbar reappears on screen rotation
- play the first video on the subsection click from the videos tab
- Bulk Download Warning Popup
- YouTube videos and flying messages
- Update firebaseRemoteConfig configurations
- Add screen for unsupported subsections instated of the first component
- `CourseUnitNavigationActivity` code improvements
- fullscreen for YouTube video with minor code improvements

---------

Co-authored-by: Farhan Arshad <[email protected]>
Co-authored-by: Omer Habib <[email protected]>

fixes: LEARNER-9625
  • Loading branch information
HamzaIsrar12 authored Sep 28, 2023
1 parent 9882175 commit 6ef292f
Show file tree
Hide file tree
Showing 25 changed files with 337 additions and 137 deletions.
2 changes: 1 addition & 1 deletion OpenEdXMobile/res/drawable/selectable_box_overlay.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/black">
android:color="@color/transparent_black_13">
<item android:id="@android:id/mask">
<shape android:shape="rectangle">
<solid android:color="@color/transparent_white_26" />
Expand Down
17 changes: 3 additions & 14 deletions OpenEdXMobile/res/layout/activity_course_tabs_dashboard.xml
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">

<FrameLayout
<androidx.fragment.app.FragmentContainerView
android:id="@+id/fragment_container_view"
android:layout_width="match_parent"
android:layout_height="match_parent">

<androidx.fragment.app.FragmentContainerView
android:id="@+id/fragment_container_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />

<TextView
android:id="@+id/flying_message"
style="@style/flying_message"
android:visibility="gone" />

</FrameLayout>
android:layout_height="match_parent" />
</layout>
16 changes: 11 additions & 5 deletions OpenEdXMobile/res/layout/activity_course_unit_navigation.xml
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,6 @@
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">

<TextView
android:id="@+id/flying_message"
style="@style/flying_message"
android:visibility="gone" />

<androidx.viewpager2.widget.ViewPager2
android:id="@+id/pager2"
android:layout_width="match_parent"
Expand All @@ -157,6 +152,17 @@
android:id="@+id/stateLayout"
layout="@layout/layout_error_state"
android:visibility="gone" />

<TextView
android:id="@+id/flying_message"
style="@style/flying_message"
android:visibility="gone" />

<include
android:id="@+id/container_layout_not_available"
layout="@layout/layout_component_not_available"
android:visibility="gone" />

</RelativeLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

Expand Down
2 changes: 1 addition & 1 deletion OpenEdXMobile/res/layout/course_dashboard_toolbar.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
android:id="@+id/collapsed_toolbar_layout"
android:layout_width="match_parent"
android:layout_height="@dimen/collapsed_toolbar_height"
android:background="@color/primaryLightColor"
android:background="@color/transparent"
app:layout_collapseMode="pin">

<LinearLayout
Expand Down
5 changes: 5 additions & 0 deletions OpenEdXMobile/res/layout/fragment_course_tabs_dashboard.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
android:id="@+id/loading_error"
layout="@layout/layout_error_state"
android:visibility="gone" />

<TextView
android:id="@+id/flying_message"
style="@style/flying_message"
android:visibility="gone" />
</FrameLayout>

</androidx.coordinatorlayout.widget.CoordinatorLayout>
59 changes: 4 additions & 55 deletions OpenEdXMobile/res/layout/fragment_course_unit_grade.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
xmlns:app="http://schemas.android.com/apk/res-auto">

<ScrollView
android:layout_width="match_parent"
Expand Down Expand Up @@ -75,60 +74,10 @@

</androidx.cardview.widget.CardView>

<LinearLayout
<include
android:id="@+id/container_layout_not_available"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:gravity="center"
android:orientation="vertical"
android:visibility="gone">

<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/content_error_icon"
android:layout_width="@dimen/unit_unavailable_error_icon_size"
android:layout_height="@dimen/unit_unavailable_error_icon_size"
android:layout_margin="@dimen/widget_margin_double"
app:srcCompat="@drawable/ic_laptop"
app:tint="@color/neutralXXDark" />

<TextView
android:id="@+id/not_available_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/edx_quadruple_margin"
android:layout_marginEnd="@dimen/edx_quadruple_margin"
android:layout_marginBottom="@dimen/widget_margin_double"
android:gravity="center"
android:singleLine="false"
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="@dimen/edx_base"
tools:text="@string/assessment_not_available" />

<TextView
android:id="@+id/not_available_message_2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/edx_quadruple_margin"
android:layout_marginEnd="@dimen/edx_quadruple_margin"
android:layout_marginBottom="@dimen/widget_margin_double"
android:gravity="center"
android:singleLine="false"
android:text="@string/assessment_explore_on_web"
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="@dimen/edx_base" />

<androidx.appcompat.widget.AppCompatButton
android:id="@+id/view_on_web_button"
style="@style/edX.Widget.SecondaryActionButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/widget_margin_double"
android:text="@string/assessment_view_on_web" />

</LinearLayout>
layout="@layout/layout_component_not_available"
android:visibility="gone" />
</FrameLayout>
</ScrollView>
</layout>
14 changes: 4 additions & 10 deletions OpenEdXMobile/res/layout/fragment_webview_discovery.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,13 @@
android:visibility="gone"
tools:visibility="visible" />

<androidx.core.widget.NestedScrollView
<org.edx.mobile.view.custom.NestedScrollWebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
app:layout_behavior="@string/appbar_scrolling_view_behavior">

<org.edx.mobile.view.custom.EdxWebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/neutralLight" />

</androidx.core.widget.NestedScrollView>
android:background="@color/neutralLight"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />

</LinearLayout>

Expand Down
56 changes: 56 additions & 0 deletions OpenEdXMobile/res/layout/layout_component_not_available.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container_layout_not_available"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:gravity="center"
android:orientation="vertical">

<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/content_error_icon"
android:layout_width="@dimen/unit_unavailable_error_icon_size"
android:layout_height="@dimen/unit_unavailable_error_icon_size"
android:layout_margin="@dimen/widget_margin_double"
app:srcCompat="@drawable/ic_laptop"
app:tint="@color/neutralXXDark" />

<TextView
android:id="@+id/not_available_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/edx_quadruple_margin"
android:layout_marginEnd="@dimen/edx_quadruple_margin"
android:layout_marginBottom="@dimen/widget_margin_double"
android:gravity="center"
android:singleLine="false"
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="@dimen/edx_base"
tools:text="@string/assessment_not_available" />

<TextView
android:id="@+id/not_available_message_2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/edx_quadruple_margin"
android:layout_marginEnd="@dimen/edx_quadruple_margin"
android:layout_marginBottom="@dimen/widget_margin_double"
android:gravity="center"
android:singleLine="false"
android:text="@string/assessment_explore_on_web"
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="@dimen/edx_base" />

<androidx.appcompat.widget.AppCompatButton
android:id="@+id/view_on_web_button"
style="@style/edX.Widget.SecondaryActionButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/widget_margin_double"
android:text="@string/assessment_view_on_web" />

</LinearLayout>
1 change: 1 addition & 0 deletions OpenEdXMobile/res/layout/sub_section_row_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
android:id="@+id/sub_section_row_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/view_selector"
android:paddingStart="@dimen/edx_default_margin"
android:paddingTop="@dimen/container_padding"
android:paddingEnd="@dimen/edx_half_margin"
Expand Down
1 change: 1 addition & 0 deletions OpenEdXMobile/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@

<color name="crop_circle_overlay_color">#c8000000</color>

<color name="transparent">@android:color/transparent</color>
<color name="transparent_black">#90000000</color>
<color name="transparent_black_80">#CC000000</color>
<color name="transparent_black_50">#80000000</color>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,21 @@ public CourseComponent getFirstIncompleteComponent() {
}
}

@Nullable
public CourseComponent getFirstIncompleteVideoComponent() {
List<VideoBlockModel> videos = getVideos();
for (CourseComponent block : videos) {
if (!block.isCompleted()) {
return block;
}
}
if (videos.size() > 0) {
return videos.get(videos.size() - 1);
} else {
return null;
}
}

public boolean isEmptyComponent() {
return type != BlockType.VIDEO &&
type != BlockType.HTML &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ data class EncodedVideos(
val youtubeVideoInfo: VideoInfo?
get() = if (youtube != null && URLUtil.isNetworkUrl(youtube.url)) youtube else null

val isYoutubeVideo = youtubeVideoInfo != null
val isYoutubeVideo
get() = youtubeVideoInfo != null

/**
* Extract the Preferred Native [VideoInfo] based on their stream priority for media playback
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.edx.mobile.model.course.VideoData;
import org.edx.mobile.model.course.VideoInfo;
import org.edx.mobile.model.db.DownloadEntry;
import org.edx.mobile.model.video.VideoQuality;

/**
* Model Factory class for the database models.
Expand Down Expand Up @@ -87,9 +88,10 @@ public static VideoModel getModel(VideoResponseModel vrm) {
* Returns an object of IVideoModel which has all the fields copied from given VideoData.
*
* @param vrm
* @param videoQuality
* @return
*/
public static VideoModel getModel(VideoData vrm, VideoBlockModel block) {
public static VideoModel getModel(VideoData vrm, VideoBlockModel block, VideoQuality videoQuality) {
DownloadEntry e = new DownloadEntry();
//FIXME - current database schema is not suitable for arbitary level of course structure tree
//solution - store the navigation path info in into one column field in the database,
Expand All @@ -100,7 +102,7 @@ public static VideoModel getModel(VideoData vrm, VideoBlockModel block) {
IBlock root = block.getRoot();
e.eid = root.getCourseId();
e.duration = vrm.duration;
final VideoInfo preferredVideoInfo = vrm.encodedVideos.getPreferredNativeVideoInfo();
final VideoInfo preferredVideoInfo = vrm.encodedVideos.getPreferredVideoInfoForDownloading(videoQuality);
e.size = preferredVideoInfo.fileSize;
e.title = block.getDisplayName();
e.url = preferredVideoInfo.url;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ public VideoModel getDownloadEntryFromVideoModel(VideoBlockModel block){
return video;
}

return DatabaseModelFactory.getModel(block.getData(), block);
return DatabaseModelFactory.getModel(block.getData(), block, userPrefs.getVideoQuality());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class ConfigUtil {
// Check firebase enabled in config
if (config.firebaseConfig.isEnabled) {
val firebaseRemoteConfig = FirebaseRemoteConfig.getInstance()
firebaseRemoteConfig.fetch(0).addOnCompleteListener {
firebaseRemoteConfig.fetchAndActivate().addOnCompleteListener {
try {
val response = JSONObject(
firebaseRemoteConfig
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import androidx.activity.OnBackPressedCallback
import androidx.core.content.ContextCompat
import androidx.fragment.app.viewModels
import androidx.viewpager2.widget.ViewPager2.OnPageChangeCallback
import com.android.billingclient.api.ProductDetails
Expand Down Expand Up @@ -395,7 +396,7 @@ class CourseTabsDashboardFragment : BaseFragment() {
}
})

courseDateViewModel.resetCourseDates.observe(viewLifecycleOwner, NonNullObserver {
courseDateViewModel.resetCourseDates.observe(viewLifecycleOwner, EventObserver {
if (!CalendarUtils.isCalendarExists(contextOrThrow, accountName, calendarTitle)) {
showShiftDateSnackBar(true)
binding.toolbar.datesBanner.root.setVisibility(false)
Expand Down Expand Up @@ -587,6 +588,12 @@ class CourseTabsDashboardFragment : BaseFragment() {
binding.toolbar.collapsingToolbarLayout,
object : CollapsingToolbarStatListener {
override fun onExpanded() {
binding.toolbar.collapsedToolbarLayout.setBackgroundColor(
ContextCompat.getColor(
requireContext(),
R.color.transparent
)
)
ViewAnimationUtil.startAlphaAnimation(
binding.toolbar.expandedToolbarLayout,
View.VISIBLE
Expand All @@ -599,6 +606,12 @@ class CourseTabsDashboardFragment : BaseFragment() {
}

override fun onCollapsed() {
binding.toolbar.collapsedToolbarLayout.setBackgroundColor(
ContextCompat.getColor(
requireContext(),
R.color.primaryLightColor
)
)
ViewAnimationUtil.startAlphaAnimation(
binding.toolbar.expandedToolbarLayout,
View.INVISIBLE
Expand Down
Loading

0 comments on commit 6ef292f

Please sign in to comment.