Example usage for android.view LayoutInflater inflate

List of usage examples for android.view LayoutInflater inflate

Introduction

In this page you can find the example usage for android.view LayoutInflater inflate.

Prototype

public View inflate(XmlPullParser parser, @Nullable ViewGroup root, boolean attachToRoot) 

Source Link

Document

Inflate a new view hierarchy from the specified XML node.

Usage

From source file:com.QuarkLabs.BTCeClient.fragments.HistoryFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    return inflater.inflate(R.layout.fragment_trade_trans_history, container, false);
}

From source file:com.citrus.sdk.fragments.DebitCard.java

public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    returnView = inflater.inflate(R.layout.activity_debit_card, container, false);

    Bundle data = getArguments();//from  w ww .ja v a  2  s . com

    paymentType = data.getString(Constants.PAY_TYPE);

    initEditText();

    initSubmitButton();

    return returnView;
}

From source file:com.gammalabs.wifianalyzer.wifi.AccessPointDetail.java

View makeView(View convertView, ViewGroup parent, @NonNull WiFiDetail wiFiDetail, boolean isChild) {
    MainActivity mainActivity = MainContext.INSTANCE.getMainActivity();

    View view = convertView;//from www.jav a 2 s  .co m
    if (view == null) {
        LayoutInflater layoutInflater = mainActivity.getLayoutInflater();
        AccessPointView accessPointView = mainActivity.getCurrentAccessPointView();
        view = layoutInflater.inflate(accessPointView.getLayout(), parent, false);
    }

    setViewCompact(mainActivity, view, wiFiDetail, isChild);
    if (view.findViewById(R.id.capabilities) != null) {
        setViewExtra(mainActivity, view, wiFiDetail);
        setViewVendorShort(view, wiFiDetail.getWiFiAdditional());
    }

    return view;
}

From source file:org.deviceconnect.android.uiapp.fragment.profile.DeviceOrientationProfileFragment.java

@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
        final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    View view = inflater.inflate(R.layout.fragment_device_orientation_service, container, false);
    view.setBackgroundColor(getResources().getColor(android.R.color.background_light));

    Button registerBtn = (Button) view.findViewById(R.id.fragment_orientation_register);
    registerBtn.setOnClickListener(new OnClickListener() {
        @Override/*from  w  ww .ja  v a  2  s. c  o m*/
        public void onClick(final View v) {
            registerEvent();
        }
    });

    Button unregisterBtn = (Button) view.findViewById(R.id.fragment_orientation_unregister);
    unregisterBtn.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(final View v) {
            unregisterEvent();
        }
    });
    return view;
}

From source file:com.hybris.mobile.app.commerce.adapter.VariantAdapter.java

/**
 * Create the view for spinner item/*w  w w. j  a  v a 2 s . c  o m*/
 *
 * @param position
 * @param convertView
 * @param parent
 * @return
 */
public View getCustomView(int position, View convertView, ViewGroup parent) {

    View rowView;

    if (convertView == null) {
        LayoutInflater inflater = (LayoutInflater) getContext()
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        rowView = inflater.inflate(R.layout.item_product_variant, parent, false);
    } else {
        rowView = convertView;
    }

    VariantOption productVariant = getItem(position);

    TextView productVariantName = (TextView) rowView.findViewById(R.id.product_variant_name);
    final ImageView productVariantImage = (ImageView) rowView.findViewById(R.id.product_variant_image);
    final ProgressBar productVariantProgressBar = (ProgressBar) rowView
            .findViewById(R.id.product_variant_image_loading);

    productVariantName.setText(
            ((List<VariantOptionQualifier>) productVariant.getVariantOptionQualifiers()).get(0).getValue());

    if (((List<VariantOptionQualifier>) productVariant.getVariantOptionQualifiers()).get(0)
            .getImage() != null) { // Loading the product image
        if (CommerceApplication.isOnline()) {

            if (StringUtils
                    .isNotBlank(((List<VariantOptionQualifier>) productVariant.getVariantOptionQualifiers())
                            .get(0).getImage().getUrl())) {

                CommerceApplication.getContentServiceHelper().loadImage(
                        ((List<VariantOptionQualifier>) productVariant.getVariantOptionQualifiers()).get(0)
                                .getImage().getUrl(),
                        null, productVariantImage, 0, 0, true, new OnRequestListener() {

                            @Override
                            public void beforeRequest() {
                                productVariantImage.setImageResource(android.R.color.transparent);
                                productVariantImage.setVisibility(View.GONE);
                                productVariantProgressBar.setVisibility(View.VISIBLE);
                            }

                            @Override
                            public void afterRequestBeforeResponse() {

                            }

                            @Override
                            public void afterRequest(boolean isDataSynced) {
                                productVariantImage.setVisibility(View.VISIBLE);
                                productVariantProgressBar.setVisibility(View.GONE);
                            }
                        }, true);
            }

        } else {
            Log.i(TAG, "Application offline, displaying no image for variant " + productVariant.getCode());
            productVariantImage
                    .setImageDrawable(getContext().getResources().getDrawable(R.drawable.no_image_product));
            productVariantImage.setVisibility(View.VISIBLE);
        }

    }

    return rowView;
}

From source file:com.scrachx.foodfacts.checker.ui.history.HistoryFragment.java

@Nullable
@Override//from  w w w  . j a va 2 s . com
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
        @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_history, container, false);
    getActivityComponent().inject(this);
    setUnBinder(ButterKnife.bind(this, view));
    mPresenter.onAttach(this);
    setUp(view);

    return view;
}

From source file:com.drisoftie.cwdroid.frag.FragBoard.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    swipeBoard = (SwipeRefreshLayout) inflater.inflate(R.layout.frag_board, container, false);
    webBoard = (WebView) swipeBoard.findViewById(R.id.web_board);
    webBoard.requestFocus(View.FOCUS_DOWN);

    webBoard.setWebViewClient(new WebViewClient() {
        @Override//  ww w .java2  s . com
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            view.loadUrl(url);
            getArguments().putString(FragBoard.class.getName(), url);
            return true;
        }
    });

    return webBoard;
}

From source file:de.geeksfactory.opacclient.frontend.InfoFragment.java

@SuppressWarnings("deprecation")
@SuppressLint("SetJavaScriptEnabled")
@Override/*from  w  w  w  .  j a v  a  2 s. c  o  m*/
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    view = inflater.inflate(R.layout.fragment_info, container, false);
    app = (OpacClient) getActivity().getApplication();

    setHasOptionsMenu(true);

    load();

    ((AppCompatActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    wvInfo = (WebView) view.findViewById(R.id.wvInfo);

    wvInfo.getSettings().setSupportZoom(true);
    wvInfo.getSettings().setJavaScriptEnabled(true);
    wvInfo.getSettings().setAppCacheMaxSize(5 * 1024 * 1024);
    wvInfo.getSettings().setAppCacheEnabled(true);
    wvInfo.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);

    wvInfo.setWebChromeClient(new WebChromeClient() {
        @Override
        public void onProgressChanged(WebView v, int progress) {
            ProgressBar Pbar = (ProgressBar) view.findViewById(R.id.pbWebProgress);
            if (progress < 100 && Pbar.getVisibility() == View.GONE) {
                Pbar.setVisibility(View.VISIBLE);
            }
            Pbar.setProgress(progress);
            if (progress == 100) {
                Pbar.setVisibility(View.GONE);
            }
        }

    });
    wvInfo.setWebViewClient(new WebViewClient() {

        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            if (url.contains(app.getLibrary().getData().optString("webviewcontain", "NOPE"))) {
                return false;
            }
            if (getActivity() == null) {
                return false;
            }
            Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
            startActivity(intent);
            return true;
        }

    });

    return view;
}

From source file:co.dilaver.quoter.fragments.PopularFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_popular, container, false);

    quoteParser = new QuoteParser();
    popularQuotesList = new ArrayList<>();
    RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.rvPopularQuotes);
    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    rootLayout = (CoordinatorLayout) view.findViewById(R.id.clPopularRoot);
    quotesAdapter = new QuotesAdapter(getActivity());
    quotesAdapter.setLongClickListener(this);
    recyclerView.setAdapter(quotesAdapter);

    MainActivity activity = (MainActivity) getActivity();
    activity.setActionBarItemsClickListener(this);

    pbPopularQuotes = (ProgressBar) view.findViewById(R.id.pbPopularQuotes);
    noPopularData = (TextView) view.findViewById(R.id.tvNoPopularData);

    noPopularData.setOnClickListener(new View.OnClickListener() {
        @Override//from w  ww .j  a v a  2s .c  o  m
        public void onClick(View v) {
            noPopularData.setVisibility(View.GONE);
            pbPopularQuotes.setVisibility(View.VISIBLE);

            getPopularQuotes();
        }
    });

    getPopularQuotes();

    return view;
}

From source file:com.royclarkson.springagram.GalleryPhotoListFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_photo, container, false);
    this.listView = (AbsListView) view.findViewById(android.R.id.list);
    this.listView.setOnItemClickListener(this);
    registerForContextMenu(this.listView);
    return view;//from   w  w  w  .j av a 2s.co m
}