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:in.codehex.facilis.LastMinuteFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_last_minute, container, false);

    initObjects(view);// w  w w. j a  va  2s. c o m
    prepareObjects();

    return view;
}

From source file:com.breadwallet.presenter.fragments.MainFragmentQR.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // The last two arguments ensure LayoutParams are inflated
    // properly.//from   w  w w  . ja  va 2 s.  c om
    final View rootView = inflater.inflate(R.layout.fragment_qr_main, container, false);

    BRWalletManager.refreshAddress();
    receiveAddress = SharedPreferencesManager.getReceiveAddress(getActivity());
    qrImageLayout = (LinearLayout) rootView.findViewById(R.id.qr_image_address_layout);
    qrcode = (ImageView) rootView.findViewById(R.id.main_image_qr_code);
    sharingFragment = new FragmentSharing();
    final RelativeLayout mainFragmentQr = (RelativeLayout) rootView.findViewById(R.id.main_fragment_qr);
    mainAddressText = (TextView) rootView.findViewById(R.id.main_address_text);
    addressLayout = (RelativeLayout) rootView.findViewById(R.id.theAddressLayout);
    String bitcoinUrl = "bitcoin:" + receiveAddress;
    mainAddressText.setText(receiveAddress);
    BRWalletManager.getInstance(getActivity()).generateQR(bitcoinUrl, qrcode);
    fm = getActivity().getFragmentManager();
    mainFragmentQr.setPadding(0, MainActivity.screenParametersPoint.y / 5, 0, 0);
    final BreadWalletApp breadWalletApp = (BreadWalletApp) getActivity().getApplication();
    addressLayout.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            breadWalletApp.cancelToast();
            if (BRAnimator.checkTheMultipressingAvailability()) {
                MainActivity app = MainActivity.app;
                if (app != null)
                    app.hideAllBubbles();
                //                    Log.e(TAG, "finalReceiveAddress: " + receiveAddress);
                sharingFragment.setTheAddress(receiveAddress);
                saveBitmapToFile();
                sharingFragment.show(fm, FragmentSharing.class.getName());
            }
        }
    });
    qrcode.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            showTips();
        }
    });
    qrImageLayout.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            showTips();
        }
    });

    final MainActivity app = MainActivity.app;
    if (app != null) {
        app.qrBubble1 = (BubbleTextView) rootView.findViewById(R.id.qr_bubble1);
        app.qrBubble2 = (BubbleTextView) rootView.findViewById(R.id.qr_bubble2);
    }
    rootView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (app != null) {
                app.hideAllBubbles();
            }
        }
    });

    setTipsPositions(rootView);

    return rootView;
}

From source file:com.scooter1556.sms.android.fragment.AudioDirectoryFragment.java

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

    mediaElementListAdapter = new MediaElementListAdapter(getActivity(), mediaElements);

    ImageView coverArt = (ImageView) rootView.findViewById(R.id.cover_art);

    Glide.with(getActivity().getBaseContext())
            .load(RESTService.getInstance().getConnection().getUrl() + "/image/" + id + "/cover/80")
            .error(R.drawable.ic_content_album).into(coverArt);

    TextView directoryTitle = (TextView) rootView.findViewById(R.id.directory_title);
    if (title != null) {
        directoryTitle.setText(title);//from w ww  . j a va  2 s .c o m
    }

    TextView directoryArtist = (TextView) rootView.findViewById(R.id.directory_artist);
    if (artist != null) {
        directoryArtist.setText(artist);
    }

    listView = (ListView) rootView.findViewById(R.id.songList);
    listView.setAdapter(mediaElementListAdapter);
    listView.setEmptyView(rootView.findViewById(R.id.emptyList));

    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            if (actionMode == null) {
                if (mediaElementListener != null) {
                    mediaElementListener.MediaElementSelected(mediaElements.get(position));
                }
            } else {
                // Add or remove selection for current list item
                onListItemSelect(position);
            }
        }
    });

    listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {

        @Override
        public boolean onItemLongClick(AdapterView<?> adapterView, View view, int position, long id) {
            onListItemSelect(position);
            return true;
        }
    });

    return rootView;
}

From source file:in.codehex.facilis.SuccessfulBidsFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_successful_bids, container, false);

    initObjects(view);/*from   ww w.  ja v  a 2 s . com*/
    prepareObjects();

    return view;
}

From source file:in.codehex.facilis.ActiveBidsFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_active_bids, container, false);

    initObjects(view);//  w  w  w .  jav  a  2 s .  c o  m
    prepareObjects();

    return view;
}

From source file:com.openerp.addons.note.AddFollowerFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    setHasOptionsMenu(true);/*from   w  w  w  .ja  va  2 s  . co  m*/
    scope = new AppScope(this);
    rootview = inflater.inflate(R.layout.fragment_add_follower, container, false);
    addFollower = (Button) rootview.findViewById(R.id.btn_note_addfollower);
    morePartners = (Button) rootview.findViewById(R.id.btn_note_loadpartners);
    partner_list = (ListView) rootview.findViewById(R.id.lstfollowers);
    addFollower.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            getSelecetedPartners();
        }
    });

    morePartners.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            LoadPartners loadpartner = new LoadPartners();
            loadpartner.execute((Void) null);
        }
    });
    return rootview;
}

From source file:li.klass.fhem.fragments.AbstractWebViewFragment.java

@SuppressLint("SetJavaScriptEnabled")
@Override/*from w w  w .j ava2  s .  co  m*/
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = super.onCreateView(inflater, container, savedInstanceState);
    if (view != null)
        return view;

    view = inflater.inflate(R.layout.webview, container, false);
    assert view != null;

    final WebView webView = (WebView) view.findViewById(R.id.webView);

    WebSettings settings = webView.getSettings();
    settings.setUseWideViewPort(true);
    settings.setLoadWithOverviewMode(true);
    settings.setJavaScriptEnabled(true);
    settings.setBuiltInZoomControls(true);

    final ProgressDialog progressDialog = new ProgressDialog(getActivity());
    progressDialog.setMessage(getResources().getString(R.string.loading));

    webView.setWebChromeClient(new WebChromeClient() {
        @Override
        public void onProgressChanged(WebView view, int newProgress) {
            super.onProgressChanged(view, newProgress);
            if (newProgress < 100) {
                progressDialog.setProgress(newProgress);
                progressDialog.show();
            } else {
                progressDialog.hide();
            }
        }
    });

    webView.setWebViewClient(new WebViewClient() {
        @Override
        public void onReceivedSslError(WebView view, @NotNull SslErrorHandler handler, SslError error) {
            handler.proceed();
        }

        @SuppressWarnings("ConstantConditions")
        @Override
        public void onReceivedHttpAuthRequest(WebView view, @NotNull HttpAuthHandler handler, String host,
                String realm) {
            FHEMServerSpec currentServer = connectionService.getCurrentServer(getActivity());
            String url = currentServer.getUrl();
            String alternativeUrl = trimToNull(currentServer.getAlternateUrl());
            try {

                String fhemUrlHost = new URL(url).getHost();
                String alternativeUrlHost = alternativeUrl == null ? null : new URL(alternativeUrl).getHost();
                String username = currentServer.getUsername();
                String password = currentServer.getPassword();

                if (host.startsWith(fhemUrlHost)
                        || (alternativeUrlHost != null && host.startsWith(alternativeUrlHost))) {
                    handler.proceed(username, password);
                } else {
                    handler.cancel();

                    Intent intent = new Intent(Actions.SHOW_TOAST);
                    intent.putExtra(BundleExtraKeys.STRING_ID, R.string.error_authentication);
                    getActivity().sendBroadcast(intent);
                }

            } catch (MalformedURLException e) {
                Intent intent = new Intent(Actions.SHOW_TOAST);
                intent.putExtra(BundleExtraKeys.STRING_ID, R.string.error_host_connection);
                getActivity().sendBroadcast(intent);
                LOG.error("malformed URL: " + url, e);

                handler.cancel();
            }
        }

        @Override
        public void onPageFinished(WebView view, String url) {
            super.onPageFinished(view, url);
            if ("about:blank".equalsIgnoreCase(url)) {
                Optional<String> alternativeUrl = getAlternateLoadUrl();
                if (alternativeUrl.isPresent()) {
                    webView.loadUrl(alternativeUrl.get());
                }
            } else {
                onPageLoadFinishedCallback(view, url);
            }
        }
    });

    return view;
}