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:de.kirchnerei.bicycle.battery.BatteryDetailFragment.java

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

From source file:com.cloudkick.monitoring.Check.java

@Override
public View getItemView(Context context, View convertView, ViewGroup parent) {
    RelativeLayout checkView;//from  w  ww .  j av  a2  s . c  o  m

    String inflater = Context.LAYOUT_INFLATER_SERVICE;
    LayoutInflater li = (LayoutInflater) context.getSystemService(inflater);

    if (convertView == null) {
        checkView = new RelativeLayout(context);
        li.inflate(R.layout.node_detail, checkView, true);
    }

    else {
        checkView = (RelativeLayout) convertView;
    }

    ((TextView) checkView.findViewById(R.id.detail_label)).setText(summary);
    ((TextView) checkView.findViewById(R.id.detail_symbol)).setTextColor(latestState.stateColor);
    ((TextView) checkView.findViewById(R.id.detail_symbol)).setText(latestState.stateSymbol);
    ((TextView) checkView.findViewById(R.id.detail_value)).setText(latestState.status);

    return checkView;
}

From source file:com.myfuture.view.WelcomeFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final View v = inflater.inflate(R.layout.track_welcome_layout, container, false);
    ((TextView) v.findViewById(R.id.greeting))
            .setText(getString(R.string.welcome_message, ParseUser.getCurrentUser().getString("firstName")));

    LinearLayout welcomeBlock = (LinearLayout) v.findViewById(R.id.welcome_color_block);
    int actionBarHeight = getActivity().getActionBar().getHeight();
    welcomeBlock.setMinimumHeight(actionBarHeight + 270);

    wecomeDescriptionTextView = (TextView) v.findViewById(R.id.welcome_description);
    ListView list = (ListView) v.findViewById(R.id.welcome_details_list);
    list.setAdapter(adapter);// ww  w  .  ja  v a  2 s.  c o  m

    return v;
}

From source file:at.bitfire.davdroid.mirakel.syncadapter.LoginURLFragment.java

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

    // protocol selection spinner
    textHttpWarning = (TextView) v.findViewById(R.id.http_warning);

    Spinner spnrScheme = (Spinner) v.findViewById(R.id.login_scheme);
    spnrScheme.setOnItemSelectedListener(new OnItemSelectedListener() {
        @Override//w w w  .ja v a2  s .com
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            scheme = parent.getAdapter().getItem(position).toString();
            textHttpWarning.setVisibility(scheme.equals("https://") ? View.GONE : View.VISIBLE);
        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {
            scheme = null;
        }
    });
    spnrScheme.setSelection(1); // HTTPS

    // other input fields
    editBaseURI = (EditText) v.findViewById(R.id.login_host_path);
    editBaseURI.addTextChangedListener(this);

    editUserName = (EditText) v.findViewById(R.id.userName);
    editUserName.addTextChangedListener(this);

    editPassword = (EditText) v.findViewById(R.id.password);
    editPassword.addTextChangedListener(this);

    checkboxPreemptive = (CheckBox) v.findViewById(R.id.auth_preemptive);

    // hook into action bar
    setHasOptionsMenu(true);

    return v;
}

From source file:at.bitfire.davdroid.ui.setup.LoginURLFragment.java

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

    // protocol selection spinner
    textHttpWarning = (TextView) v.findViewById(R.id.http_warning);

    spnrScheme = (Spinner) v.findViewById(R.id.login_scheme);
    spnrScheme.setOnItemSelectedListener(new OnItemSelectedListener() {
        @Override//from  www  .  j av a 2s .c  om
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            String scheme = parent.getAdapter().getItem(position).toString();
            textHttpWarning.setVisibility(scheme.equals("https://") ? View.GONE : View.VISIBLE);
        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {
        }
    });
    spnrScheme.setSelection(1); // HTTPS

    // other input fields
    editBaseURI = (EditText) v.findViewById(R.id.login_host_path);
    editBaseURI.addTextChangedListener(this);

    editUserName = (EditText) v.findViewById(R.id.userName);
    editUserName.addTextChangedListener(this);

    editPassword = (EditText) v.findViewById(R.id.password);
    editPassword.addTextChangedListener(this);

    checkboxPreemptive = (CheckBox) v.findViewById(R.id.auth_preemptive);

    // hook into action bar
    setHasOptionsMenu(true);

    return v;
}

From source file:com.pimp.companionforband.fragments.cloud.SummariesFragment.java

@Nullable
@Override//  ww  w.  ja va  2 s  .  c o m
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
        @Nullable Bundle savedInstanceState) {
    return inflater.inflate(R.layout.fragment_summaries, container, false);
}

From source file:com.jbirdvegas.mgerrit.ChangelogFragment.java

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

From source file:at.bitfire.davdroid.syncadapter.LoginURLFragment.java

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

    // protocol selection spinner
    textHttpWarning = (TextView) v.findViewById(R.id.http_warning);

    spnrScheme = (Spinner) v.findViewById(R.id.login_scheme);
    spnrScheme.setOnItemSelectedListener(new OnItemSelectedListener() {
        @Override/*  w  w  w  . j  a v a 2s  . co m*/
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            String scheme = parent.getAdapter().getItem(position).toString();
            textHttpWarning.setVisibility(scheme.equals("https://") ? View.GONE : View.VISIBLE);
        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {
        }
    });
    spnrScheme.setSelection(1); // HTTPS

    // other input fields
    editBaseURI = (EditText) v.findViewById(R.id.login_host_path);
    editBaseURI.addTextChangedListener(this);

    editUserName = (EditText) v.findViewById(R.id.userName);
    editUserName.addTextChangedListener(this);

    editPassword = (EditText) v.findViewById(R.id.password);
    editPassword.addTextChangedListener(this);

    checkboxPreemptive = (CheckBox) v.findViewById(R.id.auth_preemptive);

    // hook into action bar
    setHasOptionsMenu(true);

    return v;
}

From source file:com.wenwen.chatuidemo.activity.ContactlistFragment.java

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

From source file:edu.rowan.app.fragments.FoodCommentFragment.java

/**
 * Setup the view and set the button action when clicked
 *//*from w  w w.  jav  a 2  s. c  o  m*/
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.food_comment_layout, container, false);

    Button submit = (Button) view.findViewById(R.id.commentButton);
    final EditText commentField = (EditText) view.findViewById(R.id.commentField);

    submit.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            hideKeyboard(commentField);

            JsonQueryManager jsonManager = JsonQueryManager.getInstance(getActivity());
            Map<String, String> params = new HashMap<String, String>();
            String comment = commentField.getText().toString();
            comment = comment.replaceAll("<.*>", "");
            userComment = comment;
            try {
                comment = java.net.URLEncoder.encode(comment, "UTF-8");
            } catch (UnsupportedEncodingException e) {
                e.printStackTrace();
                Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
            }
            params.put(FoodRatingFragment.FOOD_ENTRY_ID, foodEntryId);
            params.put(FoodRatingFragment.USER_ID, userId);
            params.put(COMMENT_PARAM, comment);
            jsonManager.requestJson(FOOD_COMMENT_ADDR, params, FoodCommentFragment.this);
        }
    });

    return view;
}