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

Commit

Permalink
Course About page does not render properly, prohibiting enrollments
Browse files Browse the repository at this point in the history
  • Loading branch information
hanningni committed Apr 13, 2015
1 parent b7323a8 commit d5d7bb4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ protected void onCreate(Bundle savedInstanceState) {
boolean isSocialEnabled = SocialFactory.isSocialFeatureEnabled(getApplicationContext(), SocialFactory.SOCIAL_SOURCE_TYPE.TYPE_UNKNOWN);

if ( !isSocialEnabled ){
findViewById(R.id.panel_login_social).setVisibility(View.GONE);
findViewById(R.id.panel_social_layout).setVisibility(View.GONE);
findViewById(R.id.or_signup_with_email_title).setVisibility(View.GONE);
findViewById(R.id.signup_with_row).setVisibility(View.GONE);
}
else {
ImageView imgFacebook=(ImageView)findViewById(R.id.img_facebook);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.edx.mobile.view.custom;

import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Build;
Expand All @@ -12,6 +13,7 @@

import org.apache.http.protocol.HTTP;
import org.edx.mobile.logger.Logger;
import org.edx.mobile.util.NetworkUtil;

import java.util.HashMap;
import java.util.Map;
Expand Down Expand Up @@ -151,17 +153,35 @@ public boolean shouldOverrideUrlLoading(WebView view, String url) {

@Override
public WebResourceResponse shouldInterceptRequest(WebView view, String url) {
if (isExternalLink(url)) {
return new WebResourceResponse("text/html", HTTP.UTF_8, null);
try {
Context context = view.getContext().getApplicationContext();

// suppress external links on ZeroRated network
if (isExternalLink(url)
&& NetworkUtil.isOnZeroRatedNetwork(context)
&& NetworkUtil.isConnectedMobile(context)) {
return new WebResourceResponse("text/html", HTTP.UTF_8, null);
}
} catch(Exception ex) {
logger.error(ex);
}
return super.shouldInterceptRequest(view, url);
}

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request) {
if (isExternalLink(request.getUrl().toString())) {
return new WebResourceResponse("text/html", HTTP.UTF_8, null);
try {
Context context = view.getContext().getApplicationContext();

// suppress external links on ZeroRated network
if (isExternalLink(request.getUrl().toString())
&& NetworkUtil.isOnZeroRatedNetwork(context)
&& NetworkUtil.isConnectedMobile(context)) {
return new WebResourceResponse("text/html", HTTP.UTF_8, null);
}
} catch(Exception ex) {
logger.error(ex);
}
return super.shouldInterceptRequest(view, request);
}
Expand Down

0 comments on commit d5d7bb4

Please sign in to comment.