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:devfest2015.asciimmo.AsciiMmoFragment.java

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

    mTouchControllerView = (TouchControllerView) view.findViewById(R.id.touch_controller);

    mFireButton = (Button) view.findViewById(R.id.button_fire);
    mFireButton.setOnClickListener(new OnClickListener() {

        @Override/*from   www  . j a  v  a2s . c  om*/
        public void onClick(View view) {
            AsciiMmoApplication.getInstance().getSendMessageHandler().enqueueMessage(MESSAGE_TYPE_STAR_FIRE,
                    createFireMessage());
        }

    });
    return view;
}

From source file:com.hybris.mobile.adapter.AddressAdapter.java

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View rowView = inflater.inflate(R.layout.selectable_row, parent, false);
    TextView textView = (TextView) rowView.findViewById(android.R.id.text1);
    TextView textTitle = (TextView) rowView.findViewById(R.id.textTitle);

    String strName = "";

    CartDeliveryAddress address = addresses.get(position);

    if (StringUtils.isNotBlank(address.getLine1())) {
        strName = address.getLine1();//from  ww w.ja  v a 2 s .c  o m
    }
    if (StringUtils.isNotBlank(address.getLine2())) {
        strName = strName + "\n" + address.getLine2();
    }
    if (StringUtils.isNotBlank(address.getTown())) {
        strName = strName + "\n" + address.getTown();
    }
    if (StringUtils.isNotBlank(address.getPostalCode())) {
        strName = strName + "\n" + address.getPostalCode();
    }
    if (address.getCountry() != null) {
        strName = strName + "\n" + address.getCountry().getName();
    }

    textTitle.setText(address.getTitle() + " " + address.getFirstName() + " " + address.getLastName());
    textTitle.setVisibility(View.VISIBLE);

    textView.setText(strName);

    return rowView;
}

From source file:com.hybris.mobile.app.commerce.fragment.OrderConfirmationFragment.java

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

From source file:de.lebenshilfe_muenster.uk_gebaerden_muensterland.sign_browser.video.SignVideoFragment.java

@Nullable
@Override/*from w w  w. j a  v a 2 s .  co  m*/
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Log.d(TAG, "onCreateView");
    final View view = inflater.inflate(R.layout.video_fragment_view, container, false);
    this.signVideoName = (TextView) view.findViewById(R.id.signVideoName);
    this.videoView = (VideoView) view.findViewById(R.id.signVideoView);
    this.signVideoMnemonic = (TextView) view.findViewById(R.id.signVideoMnemonic);
    this.signVideoExceptionMessage = (TextView) view.findViewById(R.id.signVideoExceptionMessage);
    this.clickVideoToShowControls = (TextView) view.findViewById(R.id.clickVideoToShowControls);
    this.backToSignBrowserButton = (Button) view.findViewById(R.id.backToSignBrowserButton);
    this.backToSignBrowserButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            getActivity().onBackPressed();
        }
    });
    this.progressBar = (ProgressBar) view.findViewById(R.id.signVideoLoadingProgressCircle);
    this.videoView.setContentDescription(getActivity().getString(R.string.videoIsLoading));
    return view;
}

From source file:com.facebook.android.friendsmash.RequestUserArrayAdapter.java

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    View listItemView = inflater.inflate(R.layout.request_list_item_view, parent, false);
    ProfilePictureView profilePicView = (ProfilePictureView) listItemView
            .findViewById(R.id.requestListItemProfilePic);
    TextView nameView = (TextView) listItemView.findViewById(R.id.requestListItemName);
    final ImageView checkBox = (ImageView) listItemView.findViewById(R.id.requestListItemCheckbox);

    JSONObject currentUser = users.get(position);

    profilePicView.setProfileId(currentUser.optString("id"));
    profilePicView.setCropped(true);/*from   w  ww  .j a  v  a  2s . c o  m*/
    nameView.setText(currentUser.optString("first_name"));

    checkBox.setOnTouchListener(new View.OnTouchListener() {
        boolean checked = false;

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            // toggle image 
            if (checked) {
                checked = false;
                checkBox.setImageResource(R.drawable.checkbox_cold);
            } else {
                checked = true;
                checkBox.setImageResource(R.drawable.checkbox_hot);
            }
            return false;
        }
    });

    return listItemView;
}

From source file:li.klass.fhem.adapter.devices.FS20ZDRDeviceAdapter.java

@Override
protected List<DeviceDetailViewAction<FS20ZDRDevice>> provideDetailActions() {
    List<DeviceDetailViewAction<FS20ZDRDevice>> detailActions = super.provideDetailActions();

    detailActions.add(new DeviceDetailViewAction<FS20ZDRDevice>() {
        @Override//ww  w.j  a v  a 2s. c  om
        public View createView(Context context, LayoutInflater inflater, FS20ZDRDevice device,
                LinearLayout parent) {
            View view = inflater.inflate(R.layout.fs20_zdr_actions, parent, false);

            registerActionHandlerFor(context, view, device, R.id.vol_up, "volume_up");
            registerActionHandlerFor(context, view, device, R.id.vol_down, "volume_down");
            registerActionHandlerFor(context, view, device, R.id.left, "left");
            registerActionHandlerFor(context, view, device, R.id.right, "right");
            registerActionHandlerFor(context, view, device, R.id.slp, "sleep");
            registerActionHandlerFor(context, view, device, R.id.ms, "ms");
            registerActionHandlerFor(context, view, device, R.id.prog_1, "1");
            registerActionHandlerFor(context, view, device, R.id.prog_2, "2");
            registerActionHandlerFor(context, view, device, R.id.prog_3, "3");
            registerActionHandlerFor(context, view, device, R.id.prog_4, "4");
            registerActionHandlerFor(context, view, device, R.id.prog_5, "5");
            registerActionHandlerFor(context, view, device, R.id.prog_6, "6");
            registerActionHandlerFor(context, view, device, R.id.prog_7, "7");
            registerActionHandlerFor(context, view, device, R.id.prog_8, "8");

            return view;
        }
    });

    return detailActions;
}

From source file:at.alladin.rmbt.android.sync.RMBTSyncRequestCodeFragment.java

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

    codeText = (TextView) view.findViewById(R.id.code);

    if (syncTask == null || syncTask != null || syncTask.isCancelled()) {
        syncTask = new CheckSyncTask(activity);

        syncTask.setEndTaskListener(this);
        syncTask.execute("");
    }//  w  w  w . j  av a 2 s  .  c  o  m

    return view;
}

From source file:com.intellisys.myexample.PicassoFragment.java

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

From source file:com.achep.acdisplay.acdisplay.components.NotificationUI.java

@Override
protected View onCreateCollapsedView(LayoutInflater inflater, ViewGroup container) {
    View view = inflater.inflate(R.layout.widget_notification_icon, container, false);
    assert view != null;

    mIconView = (NotificationIconWidget) view;
    int size = Config.getInstance().getIconSize("px");
    mIconView.setLayoutParams(new ViewGroup.LayoutParams(size, size));
    mIconView.setNotification(mNotification);
    return view;/*from  w  w  w  .ja  va 2s . co  m*/
}

From source file:com.fusionx.lightirc.ui.ChannelFragment.java

@Override
protected View createView(final ViewGroup container, final LayoutInflater inflater) {
    return inflater.inflate(R.layout.fragment_channel, container, false);
}