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.cybrosys.scientific.EventListener.java

@SuppressWarnings("deprecation")
public void Memstore() {
    mHandler.onEnter();/*  w  ww .  j a  va2  s.com*/
    String strDisplay = mHandler.getDisplayText();
    if (isValidNumber(strDisplay)) {
        final String strTemp = strDisplay;
        spMemory = ctx.getSharedPreferences(PREFNAME, 0);
        LayoutInflater inflater = (LayoutInflater) ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        vwLayout = inflater.inflate(R.layout.memory,
                (ViewGroup) ((Activity) ctx).findViewById(R.id.popup_element));
        popmW1 = new PopupWindow(vwLayout, PalmCalcActivity.inDispwidth, PalmCalcActivity.inDispheight, true);
        popmW1.setBackgroundDrawable(new BitmapDrawable());
        popmW1.setOutsideTouchable(true);
        popmW1.showAtLocation(vwLayout, Gravity.CENTER, 0, 0);
        ImageButton btnCancel = (ImageButton) vwLayout.findViewById(R.id.butcancelmain);
        btnCancel.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                popmW1.dismiss();

            }
        });
        btns[0] = (Button) vwLayout.findViewById(R.id.btn1);
        btns[1] = (Button) vwLayout.findViewById(R.id.btn2);
        btns[2] = (Button) vwLayout.findViewById(R.id.btn3);
        btns[3] = (Button) vwLayout.findViewById(R.id.btn4);
        btns[4] = (Button) vwLayout.findViewById(R.id.btn5);
        btns[5] = (Button) vwLayout.findViewById(R.id.btn6);
        btns[6] = (Button) vwLayout.findViewById(R.id.btn7);
        btns[7] = (Button) vwLayout.findViewById(R.id.btn8);
        btns[8] = (Button) vwLayout.findViewById(R.id.btn9);

        for (int inI = 0; inI < 9; inI++) {

            btns[inI].setText(spMemory.getString("" + inI, "0"));

            final int inJ = inI;

            btns[inJ].setText(spMemory.getString("" + inJ, ""));

            btns[inJ].setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {

                    btns[inJ].setText(strTemp);
                    editor = spMemory.edit();
                    editor.putString("" + inJ, btns[inJ].getText().toString().equalsIgnoreCase("") ? ""
                            : btns[inJ].getText().toString());
                    editor.commit();
                    popmW1.dismiss();
                }
            });
        }
        inShift = 0;
    } else
        Toast.makeText(ctx, "Save Failed!", Toast.LENGTH_SHORT).show();
}

From source file:androidx.media.widget.MediaControlView2.java

private View inflateLayout(Context context, int resId) {
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    return inflater.inflate(resId, null);
}

From source file:com.andfchat.frontend.activities.ChatScreen.java

@Override
public void openAd(Spannable text) {
    LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    View layout = inflater.inflate(R.layout.popup_description, null);

    int height = (int) (this.height * 0.8f);
    int width = (int) (this.width * 0.8f);

    final PopupWindow descriptionPopup = new FListPopupWindow(layout, width, height);
    descriptionPopup.showAtLocation(frame, Gravity.CENTER, 0, 0);

    final TextView descriptionText = (TextView) layout.findViewById(R.id.descriptionText);
    descriptionText.setText(text);/*from w ww  .j  av  a2 s .com*/
    // Enable touching/clicking links in text
    descriptionText.setMovementMethod(LinkMovementMethod.getInstance());
}

From source file:com.amsterdam.marktbureau.makkelijkemarkt.DagvergunningFragment.java

/**
 * Update the meldingen based on the koopmanfragment meldingen data
 *//*from w w  w  . j a v  a2 s  .c  o m*/
public void populateMeldingen() {
    if (mKoopmanFragmentReady) {

        Utility.collapseView(mMeldingenContainer, true);
        mMeldingenPlaceholder.removeAllViews();

        if (mKoopmanFragment.mMeldingVerwijderd || mKoopmanFragment.mMeldingMultipleDagvergunningen
                || mKoopmanFragment.mMeldingNoValidSollicitatie) {
            LayoutInflater layoutInflater = (LayoutInflater) getActivity()
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);

            // koopman verwijderd
            if (mKoopmanFragment.mMeldingVerwijderd) {
                View meldingLayout = layoutInflater.inflate(R.layout.dagvergunning_meldingen_item, null);
                TextView meldingText = (TextView) meldingLayout.findViewById(R.id.melding);
                meldingText.setText(getString(R.string.notice_koopman_verwijderd));
                mMeldingenPlaceholder.addView(meldingLayout, mMeldingenPlaceholder.getChildCount());
            }

            // koopman heeft vandaag al een dagvergunning ontvangen
            if (mKoopmanFragment.mMeldingMultipleDagvergunningen) {
                View meldingLayout = layoutInflater.inflate(R.layout.dagvergunning_meldingen_item, null);
                TextView meldingText = (TextView) meldingLayout.findViewById(R.id.melding);
                meldingText.setText(getString(R.string.notice_koopman_multiple_dagvergunningen));
                mMeldingenPlaceholder.addView(meldingLayout, mMeldingenPlaceholder.getChildCount());
            }

            // koopman heeft geen geldige sollicitatie
            if (mKoopmanFragment.mMeldingNoValidSollicitatie) {
                View meldingLayout = layoutInflater.inflate(R.layout.dagvergunning_meldingen_item, null);
                TextView meldingText = (TextView) meldingLayout.findViewById(R.id.melding);
                meldingText.setText(getString(R.string.notice_koopman_no_valid_sollicitatie));
                mMeldingenPlaceholder.addView(meldingLayout, mMeldingenPlaceholder.getChildCount());
            }

            Utility.collapseView(mMeldingenContainer, false);
        }
    }
}

From source file:at.alladin.rmbt.android.adapter.result.RMBTResultPagerAdapter.java

@Override
public Object instantiateItem(final ViewGroup vg, final int i) {
    final Context context = vg.getContext();
    final LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    System.out.println("instantiateItem: " + i);

    View view = null;//from w  w w.j  a  v a 2 s  . c  o m

    switch (i) {
    case RESULT_PAGE_QOS:
        view = instantiateQoSDetailView(vg, inflater);
        break;
    case RESULT_PAGE_TEST:
        view = instantiateDetailView(vg, inflater);
        break;
    case RESULT_PAGE_MAIN_MENU:
        view = instantiateResultPage(vg, inflater);
        break;
    case RESULT_PAGE_MAP:
        view = instantiateMapView(vg, inflater);
        break;
    case RESULT_PAGE_GRAPH:
        view = instantiateGraphView(vg, inflater);
        break;
    }

    if (view != null)
        vg.addView(view);
    return view;
}

From source file:com.htc.dotdesign.ToolBoxService.java

private void initMenu() {
    if (mMenu != null) {
        ListView menuListView = (ListView) mMenu.findViewById(R.id.menu);
        menuListView.setAdapter(new ListAdapter() {

            @Override/*from ww  w .j a  v a 2s .c  o m*/
            public void unregisterDataSetObserver(DataSetObserver observer) {
            }

            @Override
            public void registerDataSetObserver(DataSetObserver observer) {
            }

            @Override
            public boolean isEmpty() {
                return false;
            }

            @Override
            public boolean hasStableIds() {
                return true;
            }

            @Override
            public int getViewTypeCount() {
                return 1;
            }

            @Override
            public View getView(int position, View convertView, ViewGroup parent) {
                View listItem = convertView;
                if (listItem == null) {
                    LayoutInflater inflater = (LayoutInflater) getSystemService(
                            Context.LAYOUT_INFLATER_SERVICE);
                    listItem = inflater.inflate(R.layout.menu_listitem, null);
                }
                TextView text = (TextView) listItem.findViewById(R.id.item_text);

                switch (position) {
                case MENU_ITEM_CLEAR_ALL:
                    text.setText(R.string.menu_clean_all);
                    break;
                case MENU_ITEM_INSERT_IMAGES:
                    text.setText(R.string.menu_insert);
                    break;
                case MENU_ITEM_SET_THEME:
                    text.setText(R.string.menu_set_theme);
                    break;
                case MENU_ITEM_SHARE:
                    text.setText(R.string.menu_share);
                    break;
                case MENU_ITEM_EXIT:
                    text.setText(R.string.menu_exit);
                    break;
                default:
                    break;
                }
                return listItem;
            }

            @Override
            public int getItemViewType(int position) {
                return 0;
            }

            @Override
            public long getItemId(int position) {
                return position;
            }

            @Override
            public Object getItem(int position) {
                return position;
            }

            @Override
            public int getCount() {
                return 5;
            }

            @Override
            public boolean isEnabled(int position) {
                return true;
            }

            @Override
            public boolean areAllItemsEnabled() {
                return true;
            }
        });

        menuListView.setOnItemClickListener(new OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                Log.d(DotDesignConstants.LOG_TAG,
                        LOG_PREFIX + "onItemClick, position: " + position + ", id: " + id);
                Intent intent = new Intent(TOOL_BAR_ACTION_STATUS);
                intent.putExtra(EXTRA_CURR_FUNC, FunType.Fun_Menu);
                switch (position) {
                case MENU_ITEM_CLEAR_ALL:
                    intent.putExtra(EXTRA_MENNU_ITEM, MENU_ITEM_CLEAR_ALL_STR);
                    break;
                case MENU_ITEM_INSERT_IMAGES:
                    intent.putExtra(EXTRA_MENNU_ITEM, MENU_ITEM_INSERT_IMAGES_STR);
                    break;
                case MENU_ITEM_SET_THEME:
                    intent.putExtra(EXTRA_MENNU_ITEM, MENU_ITEM_SET_THEME_STR);
                    break;
                case MENU_ITEM_SHARE:
                    intent.putExtra(EXTRA_MENNU_ITEM, MENU_ITEM_SHARE_STR);
                    break;
                case MENU_ITEM_EXIT:
                    intent.putExtra(EXTRA_MENNU_ITEM, MENU_ITEM_EXIT_STR);
                    showHideToolbar(false);
                    break;
                default:
                    break;
                }
                mLocalBroadcastManager.sendBroadcast(intent);
                setToolPanelVisibility(false);
            }
        });
    }
}

From source file:com.andrewshu.android.reddit.threads.ThreadsListActivity.java

/**
 * Resets the output UI list contents, retains session state.
 * @param threadsAdapter A ThreadsListAdapter to use. Pass in null if you want a new empty one created.
 *//*w  w  w.  jav  a2  s  . com*/
void resetUI(ThreadsListAdapter threadsAdapter) {
    findViewById(R.id.loading_light).setVisibility(View.GONE);
    findViewById(R.id.loading_dark).setVisibility(View.GONE);

    if (mSettings.isAlwaysShowNextPrevious()) {
        if (mNextPreviousView != null) {
            getListView().removeFooterView(mNextPreviousView);
            mNextPreviousView = null;
        }
    } else {
        findViewById(R.id.next_previous_layout).setVisibility(View.GONE);
        if (getListView().getFooterViewsCount() == 0) {
            // If we are not using the persistent navbar, then show as ListView footer instead
            LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            mNextPreviousView = inflater.inflate(R.layout.next_previous_list_item, null);
            getListView().addFooterView(mNextPreviousView);
        }
    }

    synchronized (THREAD_ADAPTER_LOCK) {
        if (threadsAdapter == null) {
            // Reset the list to be empty.
            mThreadsList = new ArrayList<ThingInfo>();
            mThreadsAdapter = new ThreadsListAdapter(this, mThreadsList);
        } else {
            mThreadsAdapter = threadsAdapter;
        }
        setListAdapter(mThreadsAdapter);
        mThreadsAdapter.mIsLoading = false;
        mThreadsAdapter.notifyDataSetChanged(); // Just in case
    }
    Common.updateListDrawables(this, mSettings.getTheme());
    updateNextPreviousButtons();
}

From source file:biz.bokhorst.xprivacy.ActivityMain.java

@SuppressLint("InflateParams")
private void optionSort() {
    LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(R.layout.sort, null);
    final RadioGroup rgSMode = (RadioGroup) view.findViewById(R.id.rgSMode);
    final CheckBox cbSInvert = (CheckBox) view.findViewById(R.id.cbSInvert);

    // Initialise controls
    switch (mSortMode) {
    case SORT_BY_NAME:
        rgSMode.check(R.id.rbSName);/* w w w .  j a  va2  s.com*/
        break;
    case SORT_BY_UID:
        rgSMode.check(R.id.rbSUid);
        break;
    case SORT_BY_INSTALL_TIME:
        rgSMode.check(R.id.rbSInstalled);
        break;
    case SORT_BY_UPDATE_TIME:
        rgSMode.check(R.id.rbSUpdated);
        break;
    case SORT_BY_MODIFY_TIME:
        rgSMode.check(R.id.rbSModified);
        break;
    case SORT_BY_STATE:
        rgSMode.check(R.id.rbSState);
        break;
    }
    cbSInvert.setChecked(mSortInvert);

    // Build dialog
    AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(ActivityMain.this);
    alertDialogBuilder.setTitle(R.string.menu_sort);
    alertDialogBuilder.setIcon(getThemed(R.attr.icon_launcher));
    alertDialogBuilder.setView(view);
    alertDialogBuilder.setPositiveButton(ActivityMain.this.getString(android.R.string.ok),
            new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    switch (rgSMode.getCheckedRadioButtonId()) {
                    case R.id.rbSName:
                        mSortMode = SORT_BY_NAME;
                        break;
                    case R.id.rbSUid:
                        mSortMode = SORT_BY_UID;
                        break;
                    case R.id.rbSInstalled:
                        mSortMode = SORT_BY_INSTALL_TIME;
                        break;
                    case R.id.rbSUpdated:
                        mSortMode = SORT_BY_UPDATE_TIME;
                        break;
                    case R.id.rbSModified:
                        mSortMode = SORT_BY_MODIFY_TIME;
                        break;
                    case R.id.rbSState:
                        mSortMode = SORT_BY_STATE;
                        break;
                    }
                    mSortInvert = cbSInvert.isChecked();

                    int userId = Util.getUserId(Process.myUid());
                    PrivacyManager.setSetting(userId, PrivacyManager.cSettingSortMode,
                            Integer.toString(mSortMode));
                    PrivacyManager.setSetting(userId, PrivacyManager.cSettingSortInverted,
                            Boolean.toString(mSortInvert));

                    applySort();
                }
            });
    alertDialogBuilder.setNegativeButton(ActivityMain.this.getString(android.R.string.cancel),
            new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    // Do nothing
                }
            });

    // Show dialog
    AlertDialog alertDialog = alertDialogBuilder.create();
    alertDialog.show();
}

From source file:com.google.samples.apps.iosched.ui.SessionsFragment.java

@Override
public View newCollectionItemView(Context context, int groupId, ViewGroup parent) {
    final LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    int layoutId;

    if (useExpandedMode()) {
        layoutId = R.layout.list_item_session;
    } else {//from   w w  w  .  ja  v  a 2s .c  om
        // Group HERO_GROUP_ID is the hero -- use a larger layout
        layoutId = (groupId == HERO_GROUP_ID) ? R.layout.list_item_session_hero
                : R.layout.list_item_session_summarized;
    }

    return inflater.inflate(layoutId, parent, false);
}

From source file:com.huofu.RestaurantOS.ui.splash.activate.java

/**
 * ?//  ww w  .j a v a2s . c  om
 */
public void showLoadingDialog(String text) {

    LayoutInflater inflater = (LayoutInflater) ctxt.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View grid = inflater.inflate(R.layout.loading_layout, null);

    TextView tv = (TextView) grid.findViewById(R.id.textview_loading_content);
    tv.setText(text);

    ImageView iv = (ImageView) grid.findViewById(R.id.imageview_loading_pic);
    iv.startAnimation(AnimationUtils.loadAnimation(ctxt, R.anim.rotate_loading));

    int width = CommonUtils.getScreenWidth(ctxt);
    int height = CommonUtils.getScreenHeight(ctxt);

    if (dialog_loading == null) {
        dialog_loading = new PopupWindow(grid, width, height, true);
    } else {
        dialog_loading.setContentView(grid);
    }

    dialog_loading.setFocusable(true);
    dialog_loading.setOutsideTouchable(true);
    dialog_loading.setAnimationStyle(R.style.AutoDialogAnimation);
    dialog_loading.setBackgroundDrawable(new BitmapDrawable());
    if (hasFocus) {
        dialog_loading.showAtLocation(rl_activate, Gravity.NO_GRAVITY, 0, 0);
    }

}