Advertisement
Guest User

Untitled

a guest
May 8th, 2013
398
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.55 KB | None | 0 0
  1. myWebView.setWebViewClient(new WebViewClient() {
  2. @Override
  3. public void onPageFinished(WebView view, String url) {
  4. myLoadingView.setVisibility(View.GONE);
  5. myWebView.setVisibility(View.VISIBLE);
  6. }
  7. });
  8. myWebView.loadUrl(...);
  9.  
  10. myWebView.setWebChromeClient(new WebChromeClient() {
  11. public void onProgressChanged(WebView view, int progress) {
  12. myLoadingView.setText(progress+"%");
  13. }
  14. });
  15.  
  16. super.setStringProperty("loadingDialog", "Wait, Loading...");
  17.  
  18. public class MainActivity extends DroidGap {
  19. @Override
  20. public void onCreate(Bundle savedInstanceState) {
  21. super.onCreate(savedInstanceState);
  22.  
  23. super.setIntegerProperty("splashscreen", R.drawable.splash);
  24. // Display a native loading dialog. Format for value = "Title,Message".
  25. // (String - default=null)
  26. super.setStringProperty("loadingDialog", "Wait,Loading Demo...");
  27.  
  28. super.loadUrl("file:///android_asset/www/index.html");
  29. }
  30. }
  31.  
  32. <?xml version="1.0" encoding="utf-8"?>
  33. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  34. android:layout_width="fill_parent"
  35. android:layout_height="fill_parent"
  36. android:orientation="vertical" >
  37.  
  38. <ProgressBar
  39. android:id="@+id/progressBar1"
  40. style="@android:style/Widget.ProgressBar.Horizontal"
  41. android:layout_width="fill_parent"
  42. android:layout_height="wrap_content"
  43. android:layout_alignParentBottom="true"
  44. android:layout_alignParentLeft="true"
  45. android:layout_alignParentRight="true"
  46. android:maxHeight="10dip"
  47. android:minHeight="10dip" />
  48.  
  49. </LinearLayout>
  50.  
  51. final Activity activity = this;
  52. private ProgressBar progessBar1;
  53.  
  54. View footer = View.inflate(getContext(), R.layout.mainshop, null);
  55. root.addView(footer);
  56.  
  57. progessBar1 = (ProgressBar) findViewById(R.id.progressBar1);
  58.  
  59. this.appView.setWebChromeClient(new WebChromeClient() {
  60.  
  61. public void onProgressChanged(WebView view, int progress) {
  62. activity.setProgress(progress * 1000);
  63. if(progress < 100 && progessBar1.getVisibility() == ProgressBar.GONE) {
  64. progessBar1.setVisibility(ProgressBar.VISIBLE);
  65. }
  66. progessBar1.setProgress(progress);
  67. if(progress == 100) {
  68. progessBar1.setVisibility(ProgressBar.GONE);
  69. }
  70.  
  71. Log.d("Progress", progress+"");
  72.  
  73. }
  74. });
  75.  
  76. $.mobile.showPageLoadingMsg();
  77. $('.ui-loader h1').html('<h1>Saving ... <span id="ui-loading-extra"></span>');
  78.  
  79. $('#ui-loading-extra').text(progress + '%');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement