public void activarLoad() { if (!progressActivity.isError()) { progressActivity.showLoading(); Handler handler = new Handler(); handler.postDelayed( new Runnable() { @Override public void run() { checkMe(); } }, 600); } }
@Override public void onClick(View view) { progressActivity.showLoading(); final Handler handler = new Handler(); handler.postDelayed( new Runnable() { @Override public void run() { prepareLayout(); } }, 400); }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { rootView = inflater.inflate(R.layout.fragment_instagram, container, false); progressActivity = (ProgressActivity) rootView.findViewById(R.id.InstagramProgressFragment); progressActivity.showLoading(); final Handler handler = new Handler(); handler.postDelayed( new Runnable() { @Override public void run() { prepareLayout(); } }, 400); return rootView; }
public void prepareLayout() { instagramWebView = (WebView) rootView.findViewById(R.id.instagram_webview); ConnectivityManager conMgr = null; if (getActivity() != null) { conMgr = (ConnectivityManager) getActivity().getSystemService(Context.CONNECTIVITY_SERVICE); } NetworkInfo i = conMgr.getActiveNetworkInfo(); final Drawable emptyDrawable = new IconDrawable(rootView.getContext(), Iconify.IconValue.zmdi_wifi_off) .colorRes(android.R.color.white); if (i == null || !i.isConnected() || !i.isAvailable()) { progressActivity.showError( emptyDrawable, "Error", "Al parecer hubo un error con tu conexión a Internet.", "Intentar de Nuevo", InstagramFragment.this); } else { instagramWebView.setWebViewClient( new WebViewClient() { @Override public void onPageFinished(WebView view, String url) { progressActivity.showContent(); } @Override public void onReceivedError( WebView view, WebResourceRequest request, WebResourceError error) { progressActivity.showError( emptyDrawable, "Error", "Al parecer hubo un error con tu conexión a Internet.", "Intentar de Nuevo", InstagramFragment.this); } @Override public void onReceivedHttpError( WebView view, WebResourceRequest request, WebResourceResponse errorResponse) { progressActivity.showError( emptyDrawable, "Error", "Al parecer hubo un error con tu conexión a Internet.", "Intentar de Nuevo", InstagramFragment.this); } @Override public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { progressActivity.showError( emptyDrawable, "Error", "Al parecer hubo un error con tu conexión a Internet.", "Intentar de Nuevo", InstagramFragment.this); } }); instagramWebView.getSettings().setJavaScriptEnabled(true); instagramWebView.loadUrl(INSTAGRAM_URL); } }