Example usage for android.webkit WebView setEnabled

List of usage examples for android.webkit WebView setEnabled

Introduction

In this page you can find the example usage for android.webkit WebView setEnabled.

Prototype

@RemotableViewMethod
public void setEnabled(boolean enabled) 

Source Link

Document

Set the enabled state of this view.

Usage

From source file:org.anurag.file.quest.TaskerActivity.java

/**
 * FUNCTION MAKE 3d LIST VIEW VISIBLE OR GONE AS PER REQUIREMENT
 * @param mode/*from w ww.  j  a v a 2s.c om*/
 * @param con
 */
public static void load_FIle_Gallery(final int mode) {
    final Dialog pDialog = new Dialog(mContext, R.style.custom_dialog_theme);
    final Handler handle = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            switch (msg.what) {
            case 0:
                try {
                    pDialog.setContentView(R.layout.p_dialog);
                    pDialog.setCancelable(false);
                    pDialog.getWindow().getAttributes().width = size.x * 4 / 5;
                    WebView web = (WebView) pDialog.findViewById(R.id.p_Web_View);
                    web.loadUrl("file:///android_asset/Progress_Bar_HTML/index.html");
                    web.setEnabled(false);
                    pDialog.show();
                } catch (InflateException e) {
                    error = true;
                    Toast.makeText(mContext,
                            "An exception encountered please wait while loading" + " file list",
                            Toast.LENGTH_SHORT).show();
                }
                break;
            case 1:
                if (pDialog != null)
                    if (pDialog.isShowing())
                        pDialog.dismiss();

                if (mediaFileList.size() > 0) {
                    FILE_GALLEY.setVisibility(View.GONE);
                    LIST_VIEW_3D.setVisibility(View.VISIBLE);
                    element = new MediaElementAdapter(mContext, R.layout.row_list_1, mediaFileList);
                    //AT THE PLACE OF ELEMENT YOU CAN USE MUSIC ADAPTER....
                    // AND SEE WHAT HAPPENS
                    if (mediaFileList.size() > 0) {
                        LIST_VIEW_3D.setAdapter(element);
                        LIST_VIEW_3D.setEnabled(true);
                    } else if (mediaFileList.size() == 0) {
                        LIST_VIEW_3D.setAdapter(new EmptyAdapter(mContext, R.layout.row_list_3, EMPTY));
                        LIST_VIEW_3D.setEnabled(false);
                    }
                    LIST_VIEW_3D.setDynamics(new SimpleDynamics(0.7f, 0.6f));
                    if (!elementInFocus) {
                        mFlipperBottom.showPrevious();
                        mFlipperBottom.setAnimation(prevAnim());
                        elementInFocus = true;
                    }
                    if (SEARCH_FLAG) {
                        mVFlipper.showPrevious();
                        mVFlipper.setAnimation(nextAnim());
                    }
                } else {
                    LIST_VIEW_3D.setVisibility(View.GONE);
                    FILE_GALLEY.setVisibility(View.VISIBLE);
                    Toast.makeText(mContext, R.string.empty, Toast.LENGTH_SHORT).show();
                    if (elementInFocus) {
                        mFlipperBottom.showNext();
                        mFlipperBottom.setAnimation(nextAnim());
                    }
                    elementInFocus = false;
                }
                break;
            }
        }
    };
    Thread thread = new Thread(new Runnable() {
        @Override
        public void run() {
            // TODO Auto-generated method stub
            handle.sendEmptyMessage(0);
            while (!Utils.loaded) {
                //STOPPING HERE WHILE FILES ARE BEING LOADED IN BACKGROUND....
            }
            if (mode == 0)
                mediaFileList = Utils.music;
            else if (mode == 1)
                mediaFileList = Utils.apps;
            else if (mode == 2)
                mediaFileList = Utils.doc;
            else if (mode == 3)
                mediaFileList = Utils.img;
            else if (mode == 4)
                mediaFileList = Utils.vids;
            else if (mode == 5)
                mediaFileList = Utils.zip;
            else if (mode == 6)
                mediaFileList = Utils.mis;
            handle.sendEmptyMessage(1);
        }
    });
    thread.start();
}