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

Commit

Permalink
feat: Enhance Scrolling Experience for Discover Section
Browse files Browse the repository at this point in the history
- Renamed the title from Discover to Explore the Catalog
- Defaulted the title to be hidden in favor of the webview's internal title
- The title will only be displayed upon scrolling
- Ensured consistency between the discovery experience for both guest users and logged-in users

Fixes: LEARNER-9514
  • Loading branch information
HamzaIsrar12 committed Aug 24, 2023
1 parent 8366f1f commit 2da3554
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 35 deletions.
3 changes: 1 addition & 2 deletions OpenEdXMobile/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,7 @@

<activity
android:name=".view.DiscoveryActivity"
android:label="@string/label_discover"
android:theme="@style/AppTheme.NoActionBar.TranslucentStatusBar" />
android:theme="@style/AppTheme.NoActionBar" />

<activity
android:name="org.edx.mobile.view.CertificateActivity"
Expand Down
5 changes: 2 additions & 3 deletions OpenEdXMobile/res/layout/fragment_webview_discovery.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@
<include
android:id="@+id/toolbar"
layout="@layout/collapsible_toolbar_layout"
android:visibility="gone" />
android:visibility="invisible" />

<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipe_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
android:layout_height="match_parent">

<FrameLayout
android:id="@+id/content_error_root"
Expand Down
3 changes: 3 additions & 0 deletions OpenEdXMobile/res/values/strings_2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,7 @@
<string name="continue_with_social">Continue with %s</string>
<!-- Message shown while user waits for response to a sign in request-->
<string name="signing_in">Signing in</string>

<!-- Title of Discover screen -->
<string name="label_explore_the_catalog">Explore the catalog</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBar;
import androidx.fragment.app.Fragment;

import org.edx.mobile.R;
Expand Down Expand Up @@ -41,18 +42,23 @@ public Fragment getFirstFragment() {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTitle(R.string.label_discover);
environment.getAnalyticsRegistry().trackScreenView(Analytics.Screens.FIND_COURSES);
}

@Override
public void onResume() {
super.onResume();
AuthPanelUtils.configureAuthPanel(findViewById(R.id.auth_panel), environment);
protected void configureActionBar() {
ActionBar bar = getSupportActionBar();
if (bar != null) {
bar.hide();
bar.setDisplayShowHomeEnabled(false);
bar.setDisplayHomeAsUpEnabled(false);
bar.setIcon(android.R.color.transparent);
}
}

@Override
public void setTitle(int titleId) {
setTitle(getResources().getString(titleId));
public void onResume() {
super.onResume();
AuthPanelUtils.configureAuthPanel(findViewById(R.id.auth_panel), environment);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.os.Bundle;
import android.text.TextUtils;
import android.util.TypedValue;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
Expand All @@ -22,7 +23,6 @@
import org.edx.mobile.model.api.EnrolledCoursesResponse;
import org.edx.mobile.util.UiUtils;
import org.edx.mobile.util.UrlUtil;
import org.edx.mobile.util.ViewAnimationUtil;
import org.edx.mobile.util.links.DefaultActionListener;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
Expand Down Expand Up @@ -82,29 +82,22 @@ public void onViewCreated(View view, Bundle savedInstanceState) {
}

private void initTitle() {
Bundle args = getArguments();
if (args != null && !TextUtils.isEmpty(args.getString(Router.EXTRA_SCREEN_TITLE))) {
binding.toolbar.getRoot().setVisibility(View.VISIBLE);
binding.toolbar.tvTitle.setText(args.getString(Router.EXTRA_SCREEN_TITLE));
ToolbarExtKt.setTitleStateListener(binding.toolbar.appbar,
binding.toolbar.collapsingToolbar,
new CollapsingToolbarStatListener() {
@Override
public void onExpanded() {
ViewAnimationUtil.animateTitleSize(
binding.toolbar.tvTitle,
getResources().getDimension(R.dimen.edx_x_large));
}

@Override
public void onCollapsed() {
ViewAnimationUtil.animateTitleSize(binding.toolbar.tvTitle,
getResources().getDimension(R.dimen.edx_large));
}
});
} else {
binding.toolbar.getRoot().setVisibility(View.GONE);
}
binding.toolbar.tvTitle.setText(getString(R.string.label_explore_all_courses));
binding.toolbar.tvTitle.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimension(R.dimen.edx_large));

ToolbarExtKt.setTitleStateListener(binding.toolbar.appbar,
binding.toolbar.collapsingToolbar,
new CollapsingToolbarStatListener() {
@Override
public void onExpanded() {
binding.toolbar.getRoot().setVisibility(View.INVISIBLE);
}

@Override
public void onCollapsed() {
binding.toolbar.getRoot().setVisibility(View.VISIBLE);
}
});
}

public void setWebViewActionListener() {
Expand Down

0 comments on commit 2da3554

Please sign in to comment.