use of org.edx.mobile.view.custom.URLInterceptorWebViewClient in project edx-app-android by edx.
the class BaseWebViewFindCoursesActivity method setupWebView.
private void setupWebView() {
URLInterceptorWebViewClient client = new URLInterceptorWebViewClient(this, webView);
// if all the links are to be treated as external
client.setAllLinksAsExternal(isAllLinksExternal());
client.setActionListener(this);
client.setPageStatusListener(pageStatusListener);
}
use of org.edx.mobile.view.custom.URLInterceptorWebViewClient in project edx-app-android by edx.
the class WebViewActivity method onCreate.
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_webview);
super.setToolbarAsActionBar();
final ProgressBar progress = (ProgressBar) findViewById(R.id.loading_indicator);
progress.setVisibility(View.GONE);
webView = (WebView) findViewById(R.id.webView);
final URLInterceptorWebViewClient client = new URLInterceptorWebViewClient(this, webView);
client.setPageStatusListener(new URLInterceptorWebViewClient.IPageStatusListener() {
@Override
public void onPageStarted() {
progress.setVisibility(View.VISIBLE);
}
@Override
public void onPageFinished() {
progress.setVisibility(View.GONE);
}
@Override
public void onPageLoadError(WebView view, int errorCode, String description, String failingUrl) {
progress.setVisibility(View.GONE);
}
@Override
public void onPageLoadError(WebView view, WebResourceRequest request, WebResourceResponse errorResponse, boolean isMainRequestFailure) {
if (isMainRequestFailure) {
progress.setVisibility(View.GONE);
}
}
@Override
public void onPagePartiallyLoaded() {
progress.setVisibility(View.GONE);
}
});
webView.loadUrl(getIntent().getStringExtra(ARG_URL));
final String title = getIntent().getStringExtra(ARG_TITLE);
if (!TextUtils.isEmpty(title)) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
setTitle(title);
}
}
use of org.edx.mobile.view.custom.URLInterceptorWebViewClient in project edx-app-android by edx.
the class BaseWebViewDiscoverFragment method initWebView.
private void initWebView() {
URLInterceptorWebViewClient client = new URLInterceptorWebViewClient(getActivity(), webView);
// if all the links are to be treated as external
client.setAllLinksAsExternal(isAllLinksExternal());
client.setActionListener(this);
client.setPageStatusListener(pageStatusListener);
}
use of org.edx.mobile.view.custom.URLInterceptorWebViewClient in project edx-app-android by edx.
the class CertificateFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.fragment_certificate, container, false);
webview = (WebView) view.findViewById(R.id.webview);
final View loadingIndicator = view.findViewById(R.id.loading_indicator);
final URLInterceptorWebViewClient client = new URLInterceptorWebViewClient(getActivity(), webview);
client.setPageStatusListener(new URLInterceptorWebViewClient.IPageStatusListener() {
@Override
public void onPageStarted() {
loadingIndicator.setVisibility(View.VISIBLE);
}
@Override
public void onPageFinished() {
loadingIndicator.setVisibility(View.GONE);
}
@Override
public void onPageLoadError(WebView view, int errorCode, String description, String failingUrl) {
loadingIndicator.setVisibility(View.GONE);
}
@Override
public void onPageLoadError(WebView view, WebResourceRequest request, WebResourceResponse errorResponse, boolean isMainRequestFailure) {
if (isMainRequestFailure) {
loadingIndicator.setVisibility(View.GONE);
}
}
@Override
public void onPagePartiallyLoaded() {
loadingIndicator.setVisibility(View.GONE);
}
});
return view;
}
use of org.edx.mobile.view.custom.URLInterceptorWebViewClient in project edx-app-android by edx.
the class CourseCombinedInfoFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_course_combined_info, container, false);
announcementWebView = (EdxWebView) view.findViewById(R.id.announcement_webview);
URLInterceptorWebViewClient client = new URLInterceptorWebViewClient(getActivity(), announcementWebView);
// treat every link as external link in this view, so that all links will open in external browser
client.setAllLinksAsExternal(true);
notificationSettingRow = view.findViewById(R.id.notification_setting_row);
notificationSwitch = (Switch) view.findViewById(R.id.notification_switch);
return view;
}
Aggregations