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:it.crs4.most.ehrlib.widgets.DvClusterWidget.java

private void buildClusterView() {
    LayoutInflater inflater = (LayoutInflater) _context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(R.layout.dv_cluster, null);

    _root_view = view;//  w  ww  .j  av a2  s. co m

    _clusterLayout = (LinearLayout) _root_view.findViewById(R.id.cluster_container);

    _title = (TextView) _root_view.findViewById(R.id.txt_title);

    String sectionRef = this.datatype.getSectionName();

    clusterWidgets = this._widget_provider.getClusterWidgets(sectionRef, 0);
    Log.d(TAG, String.format("In DVCLUSTER: Cluster widgets for cluster %s: %s ", sectionRef, clusterWidgets));

    addRemWidgets = (ImageView) _root_view.findViewById(R.id.image_toggle_widgets);
    addRemWidgets.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            if (areWidgetsVisible)
                removeWidgets();
            else
                addWidgets();

        }
    });

}

From source file:com.gigigo.vuforiaimplementation.VuforiaActivity.java

@Override
public void setContentViewTop(View vuforiaView) {

    LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(R.layout.activity_vuforia, null);
    scanLine = view.findViewById(R.id.scan_line);
    RelativeLayout relativeLayout = (RelativeLayout) view.findViewById(R.id.layoutContentVuforiaGL);
    relativeLayout.addView(vuforiaView, 0);
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB)

        markFakeFeaturePoint = new MarkFakeFeaturePoint(this);
    relativeLayout.addView(markFakeFeaturePoint);
    ViewGroup.LayoutParams vlp = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT);

    addContentView(view, vlp);/* ww  w.  j ava  2s.c o  m*/

    //region Button Close
    view.findViewById(R.id.btnCloseVuforia).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            finish();
        }
    });
    //endregion
    mVuforiaView = vuforiaView;
    setThemeColorScheme();

    startBoringAnimation();
    scanlineStart();

}

From source file:com.birkettenterprise.phonelocator.activity.UpdateLogActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    // add controllers before you call super.onCreate()

    mListController = new ListController(this);
    mListController.setContentView(R.layout.update_log_activity);

    addController(mListController);/* w  ww. ja  v  a  2s . c  om*/
    super.onCreate(savedInstanceState);

    setContentView(mListController.getView());

    mResourceCursorAdapter = new ResourceCursorAdapter(UpdateLogActivity.this, R.layout.update_log_list_item,
            null, true) {

        @Override
        public View newView(Context context, Cursor cur, ViewGroup parent) {
            LayoutInflater li = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            return li.inflate(R.layout.update_log_list_item, parent, false);
        }

        @Override
        public void bindView(View view, Context context, Cursor cursor) {
            String errorType = cursor.getString(ERROR_TYPE_COLUMN_INDEX);

            TextView updateTimestampView = (TextView) view.findViewById(R.id.update_log_update_timestamp);
            setTimeStamp(updateTimestampView, cursor, UPDATE_TIMESTAMP_COLUMN_INDEX);

            TextView errorView = (TextView) view.findViewById(R.id.update_log_error);

            if (errorType == null) {
                TextView locationProviderTextView = (TextView) view
                        .findViewById(R.id.update_log_location_provider);
                locationProviderTextView.setText(cursor.getString(PROVIDER_COLUMN_INDEX));
                errorView.setVisibility(View.GONE);
                view.findViewById(R.id.update_log_location_provider_layout).setVisibility(View.VISIBLE);
            } else {
                errorView.setVisibility(View.VISIBLE);
                setError(errorView, cursor, errorType);
                view.findViewById(R.id.update_log_location_provider_layout).setVisibility(View.GONE);
            }
        }
    };

    getSupportLoaderManager().initLoader(0, null, this);

    mListController.setListAdapter(mResourceCursorAdapter);
}

From source file:at.alladin.rmbt.android.views.ResultQoSDetailView.java

/**
 * /*from ww  w  .  j  ava2  s. c  o m*/
 * @param context
 * @param activity2
 */
public ResultQoSDetailView(Context context, AttributeSet attrs, RMBTMainActivity activity, String uid,
        JSONArray jsonArray) {
    super(context, attrs);
    setFillViewport(true);
    LayoutInflater layoutInflater = (LayoutInflater) getContext()
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    this.activity = activity;
    this.uid = uid;
    this.view = createView(layoutInflater);
    this.testResult = jsonArray;
}

From source file:com.smart.able2include.SimpleTextOverlayView.java

private void createView() {
    WindowManager.LayoutParams params = new WindowManager.LayoutParams(WindowManager.LayoutParams.WRAP_CONTENT,
            WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.TYPE_SYSTEM_ALERT,
            WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
            PixelFormat.TRANSLUCENT);/* w ww .ja  va  2  s .c o m*/

    params.gravity = Gravity.START | Gravity.TOP;
    params.x = 0;
    params.y = 30;
    params.width = wm.getDefaultDisplay().getWidth();
    params.height = wm.getDefaultDisplay().getHeight() - 30;

    frameLayout = new RelativeLayout(mServiceContext);
    LayoutInflater layoutInflater = (LayoutInflater) mServiceContext
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    // Here is the place where you can inject whatever layout you want.
    layoutInflater.inflate(R.layout.simpletxt_layout, frameLayout);

    TextView text = (TextView) frameLayout.findViewById(R.id.textViewSimplifiedText);
    text.setText(mSimpleText);
    dialogButton = (Button) frameLayout.findViewById(R.id.simpleButtonOK);
    // if button is clicked, close the custom dialog
    dialogButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            RemoveOvelay();
            delegate.onClick();
        }
    });
    synchronized (mSyncToken) {
        wm.addView(frameLayout, params);
        mOnTop = true;
    }
}

From source file:com.geekytheory.miguelcatalandev.developerdays.Main_Fragment_Social.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

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

    RelativeLayout layout = (RelativeLayout) inflater.inflate(R.layout.main_fragment_social, null);

    tweets = new ArrayList<Tweet>();
    adapter = new Social_Adapter_Tweets(getActivity(), tweets);
    return layout;
}

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

/**
 *
 * @param inflater/* ww w  . j  av  a2s .co  m*/
 * @param container
 * @param savedInstanceState
 * @return
 */
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.dagvergunning_fragment_product, container, false);

    // bind the elements to the view
    ButterKnife.bind(this, view);

    // get the producten from the sharedprefs and create the product selectors
    SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(getContext());
    String producten = settings
            .getString(getContext().getString(R.string.sharedpreferences_key_markt_producten), null);
    if (producten != null) {

        // split comma-separated string into list with product strings
        List<String> productList = Arrays.asList(producten.split(","));
        if (productList.size() > 0) {

            String[] productKeys = getResources().getStringArray(R.array.array_product_key);
            String[] productTypes = getResources().getStringArray(R.array.array_product_type);
            String[] productTitles = getResources().getStringArray(R.array.array_product_title);

            // inflate the producten placeholder view
            LinearLayout placeholderLayout = (LinearLayout) view.findViewById(R.id.producten_placeholder);
            if (placeholderLayout != null) {
                placeholderLayout.removeAllViews();
                LayoutInflater layoutInflater = (LayoutInflater) getActivity()
                        .getSystemService(Context.LAYOUT_INFLATER_SERVICE);

                // add multiple product item views to the placeholder view
                for (int i = 0; i < productList.size(); i++) {

                    // get a resource id for the product
                    int id = Utility.getResId("product_" + productList.get(i), R.id.class);
                    if (id != -1) {

                        // get the corresponding product type based on the productlist item value
                        String productType = "";
                        for (int j = 0; j < productKeys.length; j++) {
                            if (productKeys[j].equals(productList.get(i))) {
                                productType = productTypes[j];
                            }
                        }

                        // get the product item layout depending on the product type
                        View childLayout = null;
                        if (productType.equals("integer")) {
                            childLayout = layoutInflater.inflate(R.layout.dagvergunning_product_item_count,
                                    null);
                        } else if (productType.equals("boolean")) {
                            childLayout = layoutInflater.inflate(R.layout.dagvergunning_product_item_toggle,
                                    null);
                        }

                        if (childLayout != null) {
                            childLayout.setId(id);

                            // get the corresponding product title based on the productlist item value
                            String productTitle = "";
                            for (int j = 0; j < productKeys.length; j++) {
                                if (productKeys[j].equals(productList.get(i))) {
                                    productTitle = productTitles[j];
                                }
                            }

                            // set product name
                            TextView productNameText = (TextView) childLayout.findViewById(R.id.product_name);
                            productNameText.setText(productTitle);

                            // if product type is integer add click handlers to +- buttons
                            if (productType.equals("integer")) {

                                // set onclickhandler on the - buttons to decrease the value of the product_count textview
                                Button countDownButton = (Button) childLayout
                                        .findViewById(R.id.product_count_down);
                                countDownButton.setOnClickListener(new View.OnClickListener() {
                                    @Override
                                    public void onClick(View v) {
                                        changeProductCountText(v, false);
                                    }
                                });

                                // set onclickhandler on the + buttons to increase the value of the product_count textview
                                Button countUpButton = (Button) childLayout.findViewById(R.id.product_count_up);
                                countUpButton.setOnClickListener(new View.OnClickListener() {
                                    @Override
                                    public void onClick(View v) {
                                        changeProductCountText(v, true);
                                    }
                                });
                            }

                            // add view and move cursor to next product
                            placeholderLayout.addView(childLayout, i);
                        }
                    }
                }
            }
        }
    }

    return view;
}

From source file:com.amaze.filemanager.adapters.TabSpinnerAdapter.java

@Override
public View getDropDownView(final int position, View convertView, ViewGroup parent) {

    LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View row = inflater.inflate(R.layout.spinner_dropdown_layout, parent, false);

    ma = ((Main) fragmentTransaction.findFragmentById(R.id.content_frame));
    final TextView textView = (TextView) row.findViewById(R.id.spinnerText);
    LinearLayout linearLayout = (LinearLayout) row.findViewById(R.id.textParent);
    final SharedPreferences sharedPreferences1 = PreferenceManager.getDefaultSharedPreferences(context);
    String skin = sharedPreferences1.getString("skin_color", "#5677fc");
    final int spinner_current = sharedPreferences1.getInt("spinner_selected", 0);
    ImageButton imageButton = (ImageButton) row.findViewById(R.id.spinnerButton);
    if (items.get(position).equals("/"))
        textView.setText(R.string.rootdirectory);
    else/* w  w w. j  a va2  s. c om*/
        textView.setText(new File(items.get(position)).getName());
    imageButton.setBackgroundColor(Color.parseColor(skin));

    if (position == spinner_current) {

        textView.setTextColor(Color.parseColor(skin));
        textView.setTypeface(null, Typeface.BOLD);

    }

    linearLayout.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {

            hideSpinnerDropDown(spinner);

            if (position == spinner_current) {
            } else {

                TabHandler tabHandler1 = new TabHandler(context, null, null, 1);
                Tab tab = tabHandler1.findTab(position);
                String name = tab.getPath();
                //Toast.makeText(getActivity(), name, Toast.LENGTH_SHORT).show();
                sharedPreferences1.edit().putString("current", name).apply();
                sharedPreferences1.edit().putInt("spinner_selected", position).apply();

                Main ma = ((Main) fragmentTransaction.findFragmentById(R.id.content_frame));
                ma.loadlist(new File(tab.getPath()), false);

                Animation animationLeft = AnimationUtils.loadAnimation(getContext(), R.anim.tab_selection_left);
                Animation animationRight = AnimationUtils.loadAnimation(getContext(),
                        R.anim.tab_selection_right);

                if (position < spinner_current) {
                    ma.listView.setAnimation(animationLeft);
                    ma.gridView.setAnimation(animationLeft);
                } else {
                    ma.listView.setAnimation(animationRight);
                    ma.gridView.setAnimation(animationRight);
                }

            }
        }
    });

    imageButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {

            TabHandler tabHandler = new TabHandler(context, null, null, 1);
            Tab tab = tabHandler.findTab(position);
            if (position > spinner_current) {

                //Toast.makeText(getContext(), "Closed", Toast.LENGTH_SHORT).show();
                items.remove(position);

                int old_tab = tab.getTab();
                int a;
                for (a = old_tab; a < tabHandler.getTabsCount() - 1; a++) {

                    int new_tab = a + 1;
                    Tab tab1 = tabHandler.findTab(new_tab);
                    String next_label = tab1.getLabel();
                    String next_path = tab1.getPath();
                    tabHandler.updateTab(new Tab(a, next_label, next_path));
                }
                tabHandler.deleteTab(tabHandler.getTabsCount() - 1);
                hideSpinnerDropDown(spinner);

            } else if (position < spinner_current) {

                // Toast.makeText(getContext(), "Closed", Toast.LENGTH_SHORT).show();
                items.remove(position);
                int old_tab = tab.getTab();
                int a;
                for (a = old_tab; a < tabHandler.getTabsCount() - 1; a++) {

                    int new_tab = a + 1;
                    Tab tab1 = tabHandler.findTab(new_tab);
                    String next_label = tab1.getLabel();
                    String next_path = tab1.getPath();
                    tabHandler.updateTab(new Tab(a, next_label, next_path));
                }
                tabHandler.deleteTab(tabHandler.getTabsCount() - 1);
                int older_spinner_selected = sharedPreferences1.getInt("spinner_selected", 0);
                older_spinner_selected--;
                sharedPreferences1.edit().putInt("spinner_selected", older_spinner_selected).apply();
                hideSpinnerDropDown(spinner);

            } else if (position == spinner_current) {

                if (tabHandler.getTabsCount() == 1) {
                    // Toast.makeText(getContext(), "exits the app", Toast.LENGTH_SHORT).show();
                    ma.home();

                } else if (tabHandler.getTabsCount() - 1 > position) {
                    items.remove(position);
                    int old_tab = tab.getTab();
                    int a;
                    for (a = old_tab; a < tabHandler.getTabsCount() - 1; a++) {

                        int new_tab = a + 1;
                        Tab tab1 = tabHandler.findTab(new_tab);
                        String next_label = tab1.getLabel();
                        String next_path = tab1.getPath();
                        tabHandler.updateTab(new Tab(a, next_label, next_path));
                    }
                    tabHandler.deleteTab(tabHandler.getTabsCount() - 1);
                    Tab tab1 = tabHandler.findTab(spinner_current);
                    ma.loadlist(new File(tab1.getPath()), false);

                } else if (tabHandler.getTabsCount() - 1 == position) {
                    items.remove(position);
                    tabHandler.deleteTab(tabHandler.getTabsCount() - 1);

                    int older_spinner_selected = sharedPreferences1.getInt("spinner_selected", 0);
                    older_spinner_selected--;
                    sharedPreferences1.edit().putInt("spinner_selected", older_spinner_selected).apply();
                    Tab tab1 = tabHandler.findTab(older_spinner_selected);
                    Main ma = ((Main) fragmentTransaction.findFragmentById(R.id.content_frame));
                    ma.loadlist(new File(tab1.getPath()), false);
                }
            }
        }
    });
    return row;
}

From source file:cl.smartcities.isci.transportinspector.adapters.dialogAdapters.IncomingBusesAdapter.java

public IncomingBusesAdapter(Context pContext, ArrayList<Service> pServices, String busStop) {
    super(pContext, R.layout.bus_list_row);
    this.busStop = busStop;
    originalServices = pServices;/*from  w  w w.j a  v  a  2 s  . c  o m*/
    loadViewState();
    this.typeface = Typeface.createFromAsset(pContext.getAssets(), pContext.getString(R.string.icon_font));
    this.mInflater = (LayoutInflater) pContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    this.context = pContext;
    this.next = ContextCompat.getDrawable(this.context, R.drawable.ic_navigate_next_black_36dp);
    this.prev = ContextCompat.getDrawable(this.context, R.drawable.ic_navigate_before_black_36dp);
    this.scale = getContext().getResources().getDisplayMetrics().density;
    this.onIcon = ContextCompat.getDrawable(getContext(), R.drawable.ic_location_on_28dp);
    this.onOffIcon = ContextCompat.getDrawable(getContext(), R.drawable.ic_location_on_28dp);
    this.offIcon = ContextCompat.getDrawable(getContext(), R.drawable.ic_location_off_28dp);
    this.onIconColor = ContextCompat.getColor(getContext(), R.color.green_button);
    this.offIconColor = ContextCompat.getColor(getContext(), R.color.color_grey_off);
    this.onOffIconColor = ContextCompat.getColor(getContext(), R.color.background_white);
}

From source file:com.chute.android.photopickerplus.ui.adapter.AssetAccountAdapter.java

public AssetAccountAdapter(FragmentActivity context, AccountBaseModel baseModel,
        AdapterItemClickListener adapterItemClicklistener, DisplayType displayType) {
    this.context = context;
    this.adapterItemClickListener = adapterItemClicklistener;
    inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    loader = ImageLoader.getLoader(context.getApplicationContext());
    tick = new HashMap<Integer, AccountMediaModel>();
    rows = new ArrayList<AccountMedia>();

    if (baseModel.getFiles() != null) {
        for (AccountMediaModel file : baseModel.getFiles()) {
            rows.add(file);/* w  w  w. j  a v a2 s .c  om*/
        }
    }
    if (baseModel.getFolders() != null) {
        for (AccountAlbumModel folder : baseModel.getFolders()) {
            rows.add(folder);
        }
    }
    if (context.getResources().getBoolean(R.bool.has_two_panes)) {
        ((ServicesActivity) context).setAssetsSelectListener(this);
    } else {
        ((AssetActivity) context).setAssetsSelectListener(this);
    }
    this.displayType = displayType;
}