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.sym.demozxing.zxing.book.SearchBookContentsActivity.java

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    // Make sure that expired cookies are removed on launch.
    CookieSyncManager.createInstance(this);
    CookieManager.getInstance().removeExpiredCookie();

    Intent intent = getIntent();/*from w ww .j  a  v a 2  s  .  c o m*/
    if (intent == null || !Intents.SearchBookContents.ACTION.equals(intent.getAction())) {
        finish();
        return;
    }

    isbn = intent.getStringExtra(Intents.SearchBookContents.ISBN);
    if (LocaleManager.isBookSearchUrl(isbn)) {
        setTitle(getString(R.string.sbc_name));
    } else {
        setTitle(getString(R.string.sbc_name) + ": ISBN " + isbn);
    }

    setContentView(R.layout.search_book_contents);
    queryTextView = (EditText) findViewById(R.id.query_text_view);

    String initialQuery = intent.getStringExtra(Intents.SearchBookContents.QUERY);
    if (initialQuery != null && !initialQuery.isEmpty()) {
        // Populate the search box but don't trigger the search
        queryTextView.setText(initialQuery);
    }
    queryTextView.setOnKeyListener(keyListener);

    queryButton = findViewById(R.id.query_button);
    queryButton.setOnClickListener(buttonListener);

    resultListView = (ListView) findViewById(R.id.result_list_view);
    LayoutInflater factory = LayoutInflater.from(this);
    headerView = (TextView) factory.inflate(R.layout.search_book_contents_header, resultListView, false);
    resultListView.addHeaderView(headerView);
}

From source file:com.perm.DoomPlay.AddTrackToAlbumDialog.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    trackId = getArguments().getLong(keyDialogAlbum);
    getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE);

    View view = inflater.inflate(R.layout.list_vk, container, false);
    linearLoading = (LinearLayout) view.findViewById(R.id.linearLoading);
    listView = (ListView) view.findViewById(R.id.listVk);
    listView.setOnItemClickListener(onItemClickHandler);

    return view;/*from   www.j  a va 2  s  . c om*/
}

From source file:com.chess.genesis.activity.MsgBoxFrag.java

@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
        final Bundle savedInstanceState) {
    initBaseContentFrag(container);//from   w  w  w.ja  v a 2  s  . co m

    final View view = inflater.inflate(R.layout.fragment_msgbox, container, false);

    net = new NetworkClient(act, new Handler(this));
    progress = new ProgressMsg(act);

    // restore settings
    settings = (savedInstanceState != null) ? savedInstanceState : getArguments();
    gameid = settings.getString("gameid");

    final View btn = view.findViewById(R.id.submit_msg);
    btn.setOnClickListener(this);

    // disable touch on tabtext
    view.findViewById(R.id.tabtxt).setOnTouchListener(null);

    // set list adapters
    msglist_adapter = new MsgListAdapter(act, gameid);

    msglist_view = (ListView) view.findViewById(R.id.msg_list);
    msglist_view.setAdapter(msglist_adapter);

    // set empty view item
    final View empty = MsgListAdapter.getEmptyView(act);
    ((ViewGroup) msglist_view.getParent()).addView(empty);
    msglist_view.setEmptyView(empty);

    // scroll to bottom
    msglist_view.setSelection(msglist_view.getCount() - 1);

    return view;
}

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

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

    selectedBank = "";

    paymentType = this.getArguments().getString(Constants.PAY_TYPE);

    oneClicksignup = new OneClicksignup(getActivity());

    myOptions = new ManageOptions(getActivity());

    initListener();//  w w  w  . j av a  2 s. c o m

    initBanks();

    return returnView;
}

From source file:com.mifos.mifosxdroid.online.ClientChargeFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    rootView = inflater.inflate(R.layout.fragment_charge_list, container, false);
    setHasOptionsMenu(true);/*from   w  w w  . j  av a2s  .  c  om*/
    context = getActivity().getApplicationContext();
    ButterKnife.inject(this, rootView);
    setToolbarTitle(getString(R.string.charges));
    swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            //Do Nothing For Now
            swipeRefreshLayout.setRefreshing(false);
        }
    });

    fetchChargesList();

    return rootView;

}

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

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

    View view = inflater.inflate(R.layout.fragment_qod, container, false);

    sharedPrefStorage = new SharedPrefStorage(getActivity());

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

    font = Typeface.createFromAsset(getActivity().getAssets(), sharedPrefStorage.getQodFont());

    qodText = (TextView) view.findViewById(R.id.tvQodText);
    qodAuthor = (TextView) view.findViewById(R.id.tvQodAuthor);
    noData = (TextView) view.findViewById(R.id.tvNoData);
    rootLayout = (CoordinatorLayout) view.findViewById(R.id.clQodRoot);
    loadingQod = (ProgressBar) view.findViewById(R.id.pbQod);
    noData.setOnClickListener(new View.OnClickListener() {
        @Override/*from w w  w .  j  ava 2 s . c  o  m*/
        public void onClick(View v) {
            noData.setVisibility(View.GONE);
            loadingQod.setVisibility(View.VISIBLE);
            getQod();
        }
    });

    AutofitHelper.create(qodText);

    qodText.setTypeface(font);
    qodAuthor.setTypeface(font);
    qodText.setTextColor(sharedPrefStorage.getQodColor());
    qodAuthor.setTextColor(sharedPrefStorage.getQodColor());

    if (sharedPrefStorage.getQodText().equals("empty") || sharedPrefStorage.getQodAuthor().equals("empty")) {
        loadingQod.setVisibility(View.VISIBLE);
        getQod();
    } else {
        qodString = sharedPrefStorage.getQodText();
        authorString = sharedPrefStorage.getQodAuthor();

        qodText.setText(getString(R.string.str_WithinQuotation, qodString));
        qodAuthor.setText(authorString);
        getQod();
    }

    return view;
}

From source file:com.github.chenxiaolong.dualbootpatcher.switcher.MbtoolTaskOutputFragment.java

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

From source file:com.vmihalachi.turboeditor.fragment.NavigationDrawerListFragment.java

/**
 * {@inheritDoc}// ww w  .j a v a 2 s.co  m
 */
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Our custom layout
    View rootView = inflater.inflate(R.layout.fragment_navigation_drawer, container, false);
    return rootView;
}

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

@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
        final Bundle savedInstanceState) {
    mLogger.entering(getClass().getName(), "onCreateView",
            new Object[] { inflater, container, savedInstanceState });

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

    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(getActivity(),
            R.array.notification_type_list, android.R.layout.simple_spinner_item);
    mSpinner = (Spinner) view.findViewById(R.id.fragment_notification_service_type);
    mSpinner.setAdapter(adapter);/*  w  ww. java  2 s. c o m*/

    Button sendButton = (Button) view.findViewById(R.id.fragment_notification_service_send);
    sendButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(final View view) {
            onClickSend(view);
        }
    });

    mLogger.exiting(getClass().getName(), "onCreateView", view);
    return view;
}

From source file:gov.whitehouse.ui.fragments.app.ArticleViewerFragment.java

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

    mWebView = (WebView) v.findViewById(R.id.webview);
    mProgressBar = (ProgressBar) v.findViewById(R.id.progress);

    mWebView.getSettings().setJavaScriptEnabled(true);
    // enabling plugins may yield a better result for YouTube videos
    mWebView.getSettings().setPluginState(WebSettings.PluginState.ON);

    mWebView.setWebChromeClient(new WebChromeClient() {
        public boolean onConsoleMessage(ConsoleMessage cm) {
            Log.d(TAG, cm.message() + " -- From line " + cm.lineNumber() + " of " + cm.sourceId());
            return true;
        }/*w  ww  . j av  a  2 s  .c  o m*/
    });

    mWebView.setWebViewClient(new WebViewClient() {
        @Override
        public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
            Log.e(TAG, "Error in WebView: " + failingUrl + "; " + description);
        }

        @Override
        public void onPageFinished(WebView view, String url) {
            mProgressBar.setVisibility(View.INVISIBLE);
            mWebView.setVisibility(View.VISIBLE);
            Log.d(TAG, "page finished: " + url);

            if (url.equals(PAGE_TEMPLATE_URL)) {
                view.loadUrl(String.format("javascript:WhiteHouse.loadPage(%s);", mPageInfo.toString()));
            }
        }

        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            if (url.contains("youtube.com/")) {
                Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
                startActivity(intent);
                return true;
            }
            return false;
        }
    });

    return v;
}