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) 

Source Link

Document

Inflate a new view hierarchy from the specified xml node.

Usage

From source file:com.aqnote.app.wifianalyzer.wifi.AccessPointsDetail.java

@NonNull
public Dialog popupDialog(@NonNull Context context, @NonNull LayoutInflater inflater,
        @NonNull WiFiDetail wiFiDetail) {
    View view = inflater.inflate(R.layout.access_points_details_popup, null);
    Dialog dialog = new Dialog(context);
    dialog.setContentView(view);/*  w  w  w . j a  va 2  s . com*/
    setView(context.getResources(), view, wiFiDetail, false);
    dialog.findViewById(R.id.popupButton).setOnClickListener(new PopupDialogListener(dialog));
    return dialog;
}

From source file:com.quinsoft.zeidon.android.ZeidonTableLayout.java

@Override
public void setFromOi() {
    // Remove any current items in the table.
    removeAllViews();/*  ww w  . j  a v  a 2s  .co  m*/

    Context context = getContext();

    // Header layout supplied?
    if (hasHeaders) {
        int layoutId = context.getResources().getIdentifier(headerLayoutName, "layout",
                context.getPackageName());
        LayoutInflater inflater = LayoutInflater.from(context);
        View tableRow = inflater.inflate(layoutId, null);
        this.addView(tableRow,
                new TableLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
    }

    int layoutId = context.getResources().getIdentifier(rowLayoutName, "layout", context.getPackageName());
    LayoutInflater inflater = LayoutInflater.from(context);

    com.quinsoft.zeidon.View view = viewDelegate.findMappingView();
    for (@SuppressWarnings("unused")
    EntityInstance ei : view.cursor(getEntityName()).eachEntity()) {
        View tableRow = inflater.inflate(layoutId, null);
        this.addView(tableRow,
                new TableLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
        viewDelegate.setChildrenFromOi((TableRow) tableRow);
    }
}

From source file:com.may.ple.parking.gateway.activity.GateOutActivity.java

@Override
public void onComplete(int id, Object obj, Object passedParam) {
    try {//from w  w  w . j  a v  a  2 s.  c o m
        VehicleCheckOutCriteriaResp resp = (VehicleCheckOutCriteriaResp) obj;

        if (resp.statusCode != 9999) {
            new ErrorHandler(this).handler(resp);
            return;
        }

        VehicleCheckOutCriteriaReq req = (VehicleCheckOutCriteriaReq) passedParam;
        Map<String, Long> diffMap = resp.vehicleParking.dateTimeDiffMap;
        String dateFormat = "%1$td-%1$tm-%1$tY %1$tH:%1$tM:%1$tS";

        LayoutInflater inflater = getLayoutInflater();
        View view = inflater.inflate(R.layout.alert_dialog_checkout, null);
        ((TextView) view.findViewById(R.id.licenseNo)).setText(" : " + req.licenseNo);
        ((TextView) view.findViewById(R.id.dateIn))
                .setText(" : " + String.format(dateFormat, resp.vehicleParking.inDateTime));
        ((TextView) view.findViewById(R.id.dateOut))
                .setText(" : " + String.format(dateFormat, resp.vehicleParking.outDateTime));
        ((TextView) view.findViewById(R.id.parkingTime))
                .setText(" : " + diffMap.get("hours") + ":" + diffMap.get("minutes") + " Hrs:Mins");
        ((TextView) view.findViewById(R.id.price))
                .setText("( Price " + String.valueOf(resp.vehicleParking.price) + " Baht )");

        dialog = new AlertDialog.Builder(this).setCancelable(false).setView(view)
                .setPositiveButton("OK", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {

                    }
                }).show();

    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        spinner.dismiss();
    }
}

From source file:org.projecthdata.ehr.viewer.fragments.PatientFragment.java

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

From source file:com.vrem.wifianalyzer.wifi.AccessPointsDetail.java

public Dialog popupDialog(@NonNull Context context, @NonNull LayoutInflater inflater,
        @NonNull WiFiDetail wiFiDetail) {
    View view = inflater.inflate(R.layout.access_points_details_popup, null);
    Dialog dialog = new Dialog(context);
    dialog.setContentView(view);//from   ww w  . j  av  a  2  s.c o m
    setView(context.getResources(), view, wiFiDetail, false, true);
    dialog.findViewById(R.id.popupButton).setOnClickListener(new PopupDialogListener(dialog));
    return dialog;
}

From source file:com.insthub.O2OMobile.Fragment.F4_RefferalFragment.java

public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View mainView = inflater.inflate(R.layout.f4_refferal, null);
    mainView.setOnClickListener(null);//from  w  w w  . jav a2s  .  c  om
    mHomeMenu = (ImageView) mainView.findViewById(R.id.home_menu);
    mShare = (Button) mainView.findViewById(R.id.btn_share);
    mInviteCode = (TextView) mainView.findViewById(R.id.tv_invite_code);
    mUserModel = new UserModel(getActivity());
    mUserModel.addResponseListener(this);
    mShared = getActivity().getSharedPreferences(O2OMobileAppConst.USERINFO, 0);
    String invitecode = mShared.getString("invitecode_" + SESSION.getInstance().uid, "");
    if ("".equals(invitecode)) {
        mUserModel.getInviteCode();
    } else {
        mInviteCode.setText(invitecode);
    }
    if (!EventBus.getDefault().isregister(this)) {
        EventBus.getDefault().register(this);
    }

    return mainView;

}

From source file:com.messagesight.mqtthelper.PayloadAdapter.java

@Override
public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView,
        ViewGroup parent) {/*from ww  w.  j ava  2s. c o  m*/
    final String childText = (String) getChild(groupPosition, childPosition);
    if (convertView == null) {
        LayoutInflater inflater = (LayoutInflater) this.ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        convertView = inflater.inflate(R.layout.list_item, null);
    }
    TextView txtListChild = (TextView) convertView.findViewById(R.id.lblListItem);

    txtListChild.setText(childText);
    return convertView;
}

From source file:com.messagesight.mqtthelper.PayloadAdapter.java

@Override
public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
    String headerTitle = (String) getGroup(groupPosition);
    if (convertView == null) {
        LayoutInflater inflater = (LayoutInflater) this.ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        convertView = inflater.inflate(R.layout.list_group, null);
    }//from   w  ww. ja v  a 2 s.  c  om

    TextView lblListHeader = (TextView) convertView.findViewById(R.id.lblListHeader);
    lblListHeader.setTypeface(null, Typeface.BOLD);
    String[] tempTitle = headerTitle.split(":");
    headerTitle = tempTitle[0];
    lblListHeader.setText(headerTitle);
    return convertView;
}

From source file:edu.berkeley.boinc.adapter.NoticesListAdapter.java

@Override
public View getView(int position, View convertView, ViewGroup parent) {

    final Notice listItem = entries.get(position);

    LayoutInflater vi = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View v = vi.inflate(R.layout.notices_layout_listitem, null);

    ImageView ivIcon = (ImageView) v.findViewById(R.id.projectIcon);
    Bitmap icon = getIcon(position);// w w  w .j ava  2s  .co m
    // if available set icon, if not boinc logo
    if (icon == null) {
        ivIcon.setImageDrawable(getContext().getResources().getDrawable(R.drawable.boinc));
    } else {
        ivIcon.setImageBitmap(icon);
    }

    TextView tvProjectName = (TextView) v.findViewById(R.id.projectName);
    tvProjectName.setText(listItem.project_name);

    TextView tvNoticeTitle = (TextView) v.findViewById(R.id.noticeTitle);
    tvNoticeTitle.setText(listItem.title);

    TextView tvNoticeContent = (TextView) v.findViewById(R.id.noticeContent);
    tvNoticeContent.setText(Html.fromHtml(listItem.description));

    TextView tvNoticeTime = (TextView) v.findViewById(R.id.noticeTime);
    tvNoticeTime.setText(DateUtils.formatDate(new java.util.Date((long) listItem.create_time * 1000)));

    v.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            if (Logging.DEBUG)
                Log.d(Logging.TAG, "noticeClick: " + listItem.link);

            if (listItem.link != null && !listItem.link.isEmpty()) {
                Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(listItem.link));
                activity.startActivity(i);
            }

        }
    });

    return v;
}

From source file:com.droidstore.reparline.fragments.PostFragment.java

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

    return view;/*w ww.  ja  va 2s .  c om*/
}