Example usage for android.content Context LAYOUT_INFLATER_SERVICE

List of usage examples for android.content Context LAYOUT_INFLATER_SERVICE

Introduction

In this page you can find the example usage for android.content Context LAYOUT_INFLATER_SERVICE.

Prototype

String LAYOUT_INFLATER_SERVICE

To view the source code for android.content Context LAYOUT_INFLATER_SERVICE.

Click Source Link

Document

Use with #getSystemService(String) to retrieve a android.view.LayoutInflater for inflating layout resources in this context.

Usage

From source file:com.fastbootmobile.encore.app.adapters.SearchAdapter.java

/**
 * {@inheritDoc}/*from   w w w .ja va2 s .co  m*/
 */
@Override
public View getChildView(int i, int i2, boolean b, View root, ViewGroup parent) {
    final Context ctx = parent.getContext();
    assert ctx != null;
    if (root == null) {
        LayoutInflater inflater = (LayoutInflater) ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        root = inflater.inflate(R.layout.item_search_element, parent, false);
        ViewHolder holder = new ViewHolder();
        holder.albumArtImageView = (AlbumArtImageView) root.findViewById(R.id.ivCover);
        holder.tvTitle = (TextView) root.findViewById(R.id.tvTitle);
        holder.tvSubtitle = (TextView) root.findViewById(R.id.tvSubTitle);
        holder.divider = (TextView) root.findViewById(R.id.divider);
        holder.ivSource = (ImageView) root.findViewById(R.id.ivSource);
        holder.ivOverflow = (ImageView) root.findViewById(R.id.ivOverflow);
        holder.vRoot = root;

        holder.ivOverflow.setTag(holder);
        root.setTag(holder);
    }

    final ViewHolder tag = (ViewHolder) root.getTag();

    if (i2 == getChildrenCount(i) - 1) {
        tag.albumArtImageView.setVisibility(View.INVISIBLE);
        tag.ivSource.setVisibility(View.GONE);
        if (getChildrenCount(i) == 1) {
            tag.tvTitle.setText(R.string.search_no_results);
        } else {
            tag.tvTitle.setText(R.string.more);
        }
        tag.tvSubtitle.setText(null);
        tag.ivOverflow.setVisibility(View.GONE);
        tag.content = null;
    } else {
        tag.albumArtImageView.setVisibility(View.VISIBLE);
        tag.ivSource.setVisibility(View.VISIBLE);
        tag.ivOverflow.setVisibility(View.VISIBLE);

        switch (i) {
        case ARTIST:
            updateArtistTag(i2, tag);
            break;
        case ALBUM:
            updateAlbumTag(i2, tag);
            break;
        case SONG:
            updateSongTag(i2, tag);
            break;
        case PLAYLIST:
            updatePlaylistTag(i2, tag);
            break;
        default:
            Log.e(TAG, "Unknown group " + i);
            break;
        }
    }
    return root;
}

From source file:com.cypress.cysmart.BLEServiceFragments.RGBFragment.java

@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
        LayoutInflater inflater = (LayoutInflater) getActivity()
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        rootView = inflater.inflate(R.layout.rgb_view_landscape, null);
        ViewGroup rootViewG = (ViewGroup) getView();
        // Remove all the existing views from the root view.
        rootViewG.removeAllViews();/*from   www.  j a  v a  2  s  . c om*/
        rootViewG.addView(rootView);
        setUpControls();
        setDefaultColorPickerPositionColor();

    } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
        LayoutInflater inflater = (LayoutInflater) getActivity()
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        rootView = inflater.inflate(R.layout.rgb_view_portrait, null);
        ViewGroup rootViewG = (ViewGroup) getView();
        // Remove all the existing views from the root view.
        rootViewG.removeAllViews();
        rootViewG.addView(rootView);
        setUpControls();
        setDefaultColorPickerPositionColor();

    }

}

From source file:au.org.intersect.faims.android.ui.activity.ShowModuleActivity.java

@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    setContentView(R.layout.activity_show_module);

    // inject faimsClient and serverDiscovery
    RoboGuice.getBaseApplicationInjector(this.getApplication()).injectMembers(this);

    // initialize server discovery
    serverDiscovery.setApplication(getApplication());

    // Need to register license for the map view before create an instance of map view
    CustomMapView.registerLicense(getApplicationContext());

    this.activityData = new ShowModuleActivityData();

    rotation = AnimationUtils.loadAnimation(this, R.anim.clockwise);
    rotation.setRepeatCount(Animation.INFINITE);

    LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    syncAnimImage = (ImageView) inflater.inflate(R.layout.rotate, null);

    setupSync();/*from  w ww .j a v a 2  s.  c om*/
    setupWifiBroadcast();
    setupModule();
    setProgressBarIndeterminateVisibility(false);

    // set file browser to reset last location when activity is created
    DisplayPrefs.setLastLocation(ShowModuleActivity.this, getModuleDir());

    busyDialog = new BusyDialog(this, getString(R.string.load_module_title),
            getString(R.string.load_module_message), null);
    busyDialog.show();

    new AsyncTask<Void, Void, Void>() {

        @Override
        protected void onPostExecute(Void result) {
            renderUI(savedInstanceState);
            busyDialog.dismiss();
        }

        @Override
        protected Void doInBackground(Void... params) {
            preRenderUI();
            return null;
        };

    }.execute();
}

From source file:com.flowzr.activity.AccountListFragment.java

private void showAccountInfo(long id) {
    LayoutInflater layoutInflater = (LayoutInflater) this.getActivity()
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    NodeInflater inflater = new NodeInflater(layoutInflater);
    AccountInfoDialog accountInfoDialog = new AccountInfoDialog(this, id, db, inflater);
    accountInfoDialog.show();//w w w .j  a  v a2s  .com
}

From source file:com.example.kjpark.smartclass.NoticeTab.java

private void setSignatureLayout() {
    LayoutInflater dialogInflater = (LayoutInflater) getContext()
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    dialogView = dialogInflater.inflate(R.layout.dialog_signature, null);
    mSignaturePad = (SignaturePad) dialogView.findViewById(R.id.signature_pad);

    clearButton = (Button) dialogView.findViewById(R.id.clearButton);
    sendButton = (Button) dialogView.findViewById(R.id.sendButton);

    mSignaturePad.setOnSignedListener(new SignaturePad.OnSignedListener() {
        @Override/*  w  w  w  .j a v  a2s  . c o m*/
        public void onSigned() {
            clearButton.setEnabled(true);
            sendButton.setEnabled(true);
        }

        @Override
        public void onClear() {
            clearButton.setEnabled(false);
            sendButton.setEnabled(false);
        }
    });
    clearButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mSignaturePad.clear();
        }
    });
    sendButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            //send sign image to server
            ConnectServer.getInstance().setAsncTask(new AsyncTask<String, Void, Boolean>() {
                Bitmap signatureBitmap = mSignaturePad.getSignatureBitmap();
                private String num = Integer.toString(currentViewItem);

                @Override
                protected Boolean doInBackground(String... params) {
                    URL obj = null;
                    try {
                        obj = new URL("http://165.194.104.22:5000/enroll_sign");
                        HttpURLConnection con = (HttpURLConnection) obj.openConnection();

                        //implement below code if token is send to server
                        con = ConnectServer.getInstance().setHeader(con);

                        con.setDoOutput(true);

                        ByteArrayOutputStream baos = new ByteArrayOutputStream();
                        signatureBitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos);
                        byte[] b = baos.toByteArray();
                        String sign_image = Base64.encodeToString(b, Base64.DEFAULT);
                        Log.d(TAG, "sign_image: " + sign_image.length());

                        String parameter = URLEncoder.encode("num", "UTF-8") + "="
                                + URLEncoder.encode(num, "UTF-8");
                        parameter += "&" + URLEncoder.encode("sign_image", "UTF-8") + "="
                                + URLEncoder.encode(sign_image, "UTF-8");

                        OutputStreamWriter wr = new OutputStreamWriter(con.getOutputStream());
                        wr.write(parameter);
                        wr.flush();

                        BufferedReader rd = null;

                        if (con.getResponseCode() == 200) {
                            // ? 
                            rd = new BufferedReader(new InputStreamReader(con.getInputStream(), "UTF-8"));

                            Log.d("---- success ----", rd.toString());

                        } else {
                            // ? 
                            rd = new BufferedReader(new InputStreamReader(con.getErrorStream(), "UTF-8"));
                            Log.d("---- failed ----", String.valueOf(rd.readLine()));
                        }
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                    return null;
                }

                @Override
                protected void onPostExecute(Boolean aBoolean) {

                }
            });
            ConnectServer.getInstance().execute();
            signature_dialog.dismiss();
            loadBoards();
        }
    });
}

From source file:radu.pidroid.Controller.java

private void createDrawerRows() {
    /*/*from   w  w w .j a v  a  2 s.co m*/
     NOTE:  1. These constants must be in accordance with StringArray
            "drawer_items_list" in res/values/strings.xml
        2. Used only to help automate the creation process of drawer items
    */
    final int DRAWER_HEADER = 0, DRAWER_ROW = 1, DRAWER_SETTINGS_ROW = 2;

    //
    parentData = new ArrayList<DrawerItem>();
    childData = new HashMap<DrawerItem, List<DrawerItem>>();

    LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    //
    DrawerItem parent = null, child = null;
    List<DrawerItem> children;

    //
    for (int index = 0; index < mDrawerItemsList.length; index++) {

        //
        String[] parts = mDrawerItemsList[index].split(",");
        children = new ArrayList<DrawerItem>();

        //
        switch (Integer.parseInt(parts[0])) {

        case DRAWER_HEADER:
            parent = new DrawerHeader(this, inflater.inflate(R.layout.drawer_header, null));
            ((DrawerHeader) parent).setHeaderText(parts[1]);
            parentData.add(parent);
            break;

        case DRAWER_ROW:
            parent = new DrawerRow(this, inflater.inflate(R.layout.drawer_row, null));
            ((DrawerRow) parent).setRowText(parts[1]);
            ((DrawerRow) parent).setIconResource(android.R.drawable.ic_menu_always_landscape_portrait);
            parentData.add(parent);
            break;

        case DRAWER_SETTINGS_ROW:
            parent = new DrawerRow(this, inflater.inflate(R.layout.drawer_row, null));
            ((DrawerRow) parent).setRowText(parts[1]);
            ((DrawerRow) parent).setIconResource(android.R.drawable.ic_menu_always_landscape_portrait);
            parentData.add(parent);

            child = new DrawerSettingsRow(this, inflater.inflate(R.layout.drawer_settings_row, null));
            children.add(child);
            break;

        default:
            // invalid drawer item type
            Log.e("createDrawerRows(): ", "Check strings.xml");
        } // switch

        //
        childData.put(parent, children);
    } // for

    /*  The next part defines the behaviour of the drawer items.
            
    Because of the different types of rows, hard-coding these is the easiest
     approach as opposed to further complicating things to simply create them.
     */
    // TOUCH CONTROLS
    ((DrawerRow) parentData.get(1)).setRowFunction(new DrawerRow.ToggleSettings() {
        @Override
        public void toggle() {
            setControls(TOUCH_CONTROLS);
            mDrawerLayout.closeDrawer(mDrawerListView);
            Toast.makeText(parentData.get(1).getUIContext(), "Touch controls have been set", Toast.LENGTH_SHORT)
                    .show();
        } // toggle
    });

    // SLIDER CONTROLS
    ((DrawerRow) parentData.get(2)).setRowFunction(new DrawerRow.ToggleSettings() {
        @Override
        public void toggle() {
            setControls(SLIDER_CONTROLS);
            mDrawerLayout.closeDrawer(mDrawerListView);
            Toast.makeText(parentData.get(2).getUIContext(), "Slider controls have been set",
                    Toast.LENGTH_SHORT).show();
        } // toggle
    });

    // JOYSTICK CONTROLS
    ((DrawerRow) parentData.get(3)).setRowFunction(new DrawerRow.ToggleSettings() {
        @Override
        public void toggle() {
            setControls(JOYSTICK_CONTROLS);
            mDrawerLayout.closeDrawer(mDrawerListView);
            Toast.makeText(parentData.get(3).getUIContext(), "Joystick controls have been set",
                    Toast.LENGTH_SHORT).show();
        } // toggle
    });

    // MAXIMUM TILT ANGLE
    ((DrawerSettingsRow) childData.get(parentData.get(5)).get(0))
            .setSettingsFunction(new DrawerSettingsRow.SliderSettings() {
                @Override
                public String calculate(int progress) {
                    maxTiltAngle = (int) (progress * 0.8 + 10) / 10 * 10;
                    return Controller.maxTiltAngle + "";
                } // calculate
            });
    ((DrawerSettingsRow) childData.get(parentData.get(5)).get(0))
            .initialise((int) ((maxTiltAngle / 10 * 10 - 10) / 0.8));

    // ACCELERATION TIME
    ((DrawerSettingsRow) childData.get(parentData.get(6)).get(0))
            .setSettingsFunction(new DrawerSettingsRow.SliderSettings() {
                @Override
                public String calculate(int progress) {
                    accelerationTime = progress / 10 * 250;
                    return accelerationTime + "ms";
                } // calculate
            });
    ((DrawerSettingsRow) childData.get(parentData.get(6)).get(0)).initialise(accelerationTime / 250 * 10);

    // DECELERATION TIME
    ((DrawerSettingsRow) childData.get(parentData.get(7)).get(0))
            .setSettingsFunction(new DrawerSettingsRow.SliderSettings() {
                @Override
                public String calculate(int progress) {
                    decelerationTime = progress / 10 * 250;
                    return decelerationTime + "ms";
                } // calculate
            });
    ((DrawerSettingsRow) childData.get(parentData.get(7)).get(0)).initialise(decelerationTime / 250 * 10);

    // TOUCH RESPONSIVENESS
    ((DrawerSettingsRow) childData.get(parentData.get(8)).get(0))
            .setSettingsFunction(new DrawerSettingsRow.SliderSettings() {
                @Override
                public String calculate(int progress) {
                    touchResponsiveness = progress / 10 * 50;
                    return touchResponsiveness + "ms";
                } // calculate
            });
    ((DrawerSettingsRow) childData.get(parentData.get(8)).get(0)).initialise(touchResponsiveness / 50 * 10);

    // TURN SENSITIVITY
    ((DrawerSettingsRow) childData.get(parentData.get(10)).get(0))
            .setSettingsFunction(new DrawerSettingsRow.SliderSettings() {
                @Override
                public String calculate(int progress) {
                    turnSensitivity = progress / 25 + 1;
                    mMessenger.updateTurnSensitivity(turnSensitivity);
                    return turnSensitivity + "";
                } // calculate
            });
    ((DrawerSettingsRow) childData.get(parentData.get(10)).get(0)).initialise((turnSensitivity - 1) * 25);

    // LEARN NEW OBJECT
    ((DrawerRow) parentData.get(11)).setRowFunction(new DrawerRow.ToggleSettings() {
        @Override
        public void toggle() {
            mDrawerLayout.closeDrawer(mDrawerListView);

            // Before we fire of the learning process, ask the user what this new object is
            new AlertDialog.Builder(parentData.get(11).getUIContext(), AlertDialog.THEME_HOLO_DARK)
                    .setTitle("What is this new object?").setIcon(android.R.drawable.ic_dialog_info)
                    .setItems(R.array.object_names, new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialogInterface, int index) {
                            new LearningTask(parentData.get(11).getUIContext(), LearningTask.PIDROID_LEARN,
                                    index).execute();
                        } // onClick
                    }).setCancelable(false).create().show();
        } // toggle
    });

    // RECOGNISE OBJECT
    ((DrawerRow) parentData.get(12)).setRowFunction(new DrawerRow.ToggleSettings() {
        @Override
        public void toggle() {
            mDrawerLayout.closeDrawer(mDrawerListView);
            new LearningTask(parentData.get(12).getUIContext(), LearningTask.PIDROID_RECOGNISE).execute();
        } // toggle
    });

    // CLEAR LEARNING DATA
    ((DrawerRow) parentData.get(13)).setRowFunction(new DrawerRow.ToggleSettings() {
        @Override
        public void toggle() {
            new AlertDialog.Builder(parentData.get(13).getUIContext(), AlertDialog.THEME_HOLO_DARK)
                    .setTitle("Clear Data").setMessage("Are you sure you want to delete all learned data?")
                    .setIcon(android.R.drawable.ic_dialog_alert)
                    .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialogInterface, int i) {
                            mMessenger.clearLearningData();
                        } // onClick
                    }) // .setPositiveButton
                    .setNegativeButton(android.R.string.cancel, null).create().show();
        } // toggle
    });

    // CAMERA STABILISATION
    ((DrawerRow) parentData.get(15)).setRowFunction(new DrawerRow.ToggleSettings() {
        @Override
        public void toggle() {
            mDrawerLayout.closeDrawer(mDrawerListView);
            cameraStabilisationOn = !cameraStabilisationOn;
            videoFeedMjpegView.setCameraStabilisation(cameraStabilisationOn);

            if (cameraStabilisationOn)
                Toast.makeText(parentData.get(15).getUIContext(), "Camera stabilisation is now ON",
                        Toast.LENGTH_LONG).show();
            else
                Toast.makeText(parentData.get(15).getUIContext(), "Camera stabilisation is now OFF",
                        Toast.LENGTH_LONG).show();
        } // toggle
    });

    // CHANGE HUD
    ((DrawerRow) parentData.get(16)).setRowFunction(new DrawerRow.ToggleSettings() {
        @Override
        public void toggle() {
            if (++currentHudResource == hudResources.length)
                currentHudResource = 0;
            hudImageView.setImageResource(hudResources[currentHudResource]);
        } // toggle
    });

    // LEVEL INDICATOR
    ((DrawerRow) parentData.get(17)).setRowFunction(new DrawerRow.ToggleSettings() {
        @Override
        public void toggle() {
            if (levelIndicatorImageView.getVisibility() == View.VISIBLE)
                levelIndicatorImageView.setVisibility(View.INVISIBLE);
            else
                levelIndicatorImageView.setVisibility(View.VISIBLE);
        } // toggle
    });

    // TUTORIALS
    ((DrawerRow) parentData.get(18)).setRowFunction(new DrawerRow.ToggleSettings() {
        @Override
        public void toggle() {
            tutorialsOn = !tutorialsOn;
            mDrawerLayout.closeDrawer(mDrawerListView);

            if (tutorialsOn)
                Toast.makeText(parentData.get(18).getUIContext(), "Tutorials are now ON", Toast.LENGTH_LONG)
                        .show();
            else
                Toast.makeText(parentData.get(18).getUIContext(), "Tutorials are now OFF", Toast.LENGTH_LONG)
                        .show();
        } // toggle
    });
}

From source file:com.kyakujin.android.tagnotepad.ui.NoteListFragment.java

/**
 * About//from ww  w  .  ja v a  2 s  .com
 */
private void showAboutDialog() {
    PackageManager pm = getActivity().getPackageManager();
    String packageName = getActivity().getPackageName();
    String versionName;
    try {
        PackageInfo info = pm.getPackageInfo(packageName, 0);
        versionName = info.versionName;
    } catch (PackageManager.NameNotFoundException e) {
        versionName = "N/A";
    }

    SpannableStringBuilder aboutBody = new SpannableStringBuilder();

    SpannableString mailAddress = new SpannableString(getString(R.string.mailto));
    mailAddress.setSpan(new ClickableSpan() {
        @Override
        public void onClick(View view) {
            Intent intent = new Intent();
            intent.setAction(Intent.ACTION_SENDTO);
            intent.setData(Uri.parse(getString(R.string.description_mailto)));
            intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.description_mail_subject));
            startActivity(intent);
        }
    }, 0, mailAddress.length(), 0);

    aboutBody.append(Html.fromHtml(getString(R.string.about_body, versionName)));
    aboutBody.append("\n");
    aboutBody.append(mailAddress);

    LayoutInflater layoutInflater = (LayoutInflater) getActivity()
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    TextView aboutBodyView = (TextView) layoutInflater.inflate(R.layout.fragment_about_dialog, null);
    aboutBodyView.setText(aboutBody);
    aboutBodyView.setMovementMethod(LinkMovementMethod.getInstance());

    AlertDialog dlg = new AlertDialog.Builder(getActivity()).setTitle(R.string.alert_title_about)
            .setView(aboutBodyView).setPositiveButton("OK", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                }
            }).create();
    dlg.show();
}

From source file:com.audiokernel.euphonyrmt.MainMenuActivity.java

private TextView initializeTextView() {
    final LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    final TextView textView = (TextView) inflater.inflate(R.layout.actionbar_title, null);

    textView.setFocusable(true);//from  w  w w. ja  va 2 s  . co m
    textView.setFocusableInTouchMode(true);
    textView.setSelected(true);
    textView.requestFocus();

    return textView;
}

From source file:com.example.angelina.travelapp.map.MapFragment.java

/**
 * Show a special header when routes are displayed
 *//*from   ww  w. ja v a2 s .co m*/
private void showRouteHeader(double travelTime) {
    final LayoutInflater inflater = (LayoutInflater) getActivity()
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    final LinearLayout.LayoutParams layout = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.WRAP_CONTENT);
    mRouteHeaderView = inflater.inflate(R.layout.route_header, null);
    final TextView tv = (TextView) mRouteHeaderView.findViewById(R.id.route_bar_title);
    tv.setElevation(6f);
    tv.setText(mCenteredPlace != null ? mCenteredPlace.getName() : null);
    tv.setTextColor(Color.WHITE);
    final TextView time = (TextView) mRouteHeaderView.findViewById(R.id.routeTime);
    time.setText(Math.round(travelTime) + " min");
    final ImageView btnClose = (ImageView) mRouteHeaderView.findViewById(R.id.btnClose);
    final ImageView btnDirections = (ImageView) mRouteHeaderView.findViewById(R.id.btnDirections);
    final ActionBar ab = ((AppCompatActivity) getActivity()).getSupportActionBar();
    if (ab != null) {
        ab.hide();
    }

    mMapView.addView(mRouteHeaderView, layout);
    btnClose.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(final View v) {
            mMapView.removeView(mRouteHeaderView);
            if (ab != null) {
                ab.show();
            }

            // Clear route
            if (mRouteOverlay != null) {
                mRouteOverlay.getGraphics().clear();
            }
            if (mViewpoint != null) {
                mMapView.setViewpoint(mViewpoint);
            }
            mPresenter.start();
        }
    });
    btnDirections.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(final View v) {
            // show directions
            ((MapActivity) getActivity()).showDirections(mRouteDirections);
        }
    });
}

From source file:com.actionbarsherlock.plus.SherlockDialogPlusFragment.java

/** @hide */
@Override/*  w ww  .j  a v a2  s .  co  m*/
public LayoutInflater getLayoutInflater(Bundle savedInstanceState) {
    if (!mShowsDialog) {
        return super.getLayoutInflater(savedInstanceState);
    }

    mDialog = onCreateDialog(savedInstanceState);
    switch (mStyle) {
    case STYLE_NO_INPUT:
        mDialog.getWindow().addFlags(
                WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
        // fall through...
    case STYLE_NO_FRAME:
    case STYLE_NO_TITLE:
        mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    }
    mDialog.setCancelable(true);
    mDialog.setCanceledOnTouchOutside(true);
    mDialog.getWindow().setGravity(mGravity);
    if (mDialog != null) {
        return (LayoutInflater) mDialog.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    }
    return (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}