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:it.crs4.most.ehrlib.widgets.DvClusterWidget.java

private void buildClusterView() {
    LayoutInflater inflater = (LayoutInflater) _context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(R.layout.dv_cluster, null);

    _root_view = view;// ww w . j  a  v  a2s  .c o m

    _clusterLayout = (LinearLayout) _root_view.findViewById(R.id.cluster_container);

    _title = (TextView) _root_view.findViewById(R.id.txt_title);

    String sectionRef = this.datatype.getSectionName();

    clusterWidgets = this._widget_provider.getClusterWidgets(sectionRef, 0);
    Log.d(TAG, String.format("In DVCLUSTER: Cluster widgets for cluster %s: %s ", sectionRef, clusterWidgets));

    addRemWidgets = (ImageView) _root_view.findViewById(R.id.image_toggle_widgets);
    addRemWidgets.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            if (areWidgetsVisible)
                removeWidgets();
            else
                addWidgets();

        }
    });

}

From source file:com.balieiro.facebook.FriendItem.java

public View getPictureView(LayoutInflater inflater) {
    if (mPicView == null) {
        LinearLayout layout = (LinearLayout) inflater.inflate(R.layout.picture_layout, null);
        mPicView = (ImageView) layout.findViewById(R.id.friend_image);
        mPictureLoader = new LoadPictureTask();
        mPictureLoader.execute();//from ww  w  .  j  av a  2s.  c  om
    }
    return mPicView.getRootView();
}

From source file:fr.julienvermet.bugdroid.ui.BugCommentsFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_bug_comments, null);
    mCommentAdd = (ViewGroup) view.findViewById(R.id.commentAdd);
    mCommentMessage = (EditText) view.findViewById(R.id.commentMessage);
    mCommentSend = (ImageButton) view.findViewById(R.id.commentSend);
    mCommentSendProgress = (ProgressBar) view.findViewById(R.id.commentSendProgress);
    mCommentSend.setOnClickListener(this);
    return view;//from  w w  w. ja  v a2  s.c o m
}

From source file:com.miuidev.themebrowser.MainActivity.java

private void displayAbout() {
    AlertDialog.Builder builder;/* ww w . ja  va 2  s . c  om*/
    AlertDialog alertDialog;

    LayoutInflater inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE);
    View layout = inflater.inflate(R.layout.dialog_about,
            (ViewGroup) findViewById(R.id.DialogAboutRelativeLayout));

    TextView text = (TextView) layout.findViewById(R.id.AboutVersionValue);
    text.setText(getVersionName());

    builder = new AlertDialog.Builder(this);
    builder.setView(layout);
    builder.setCancelable(false).setPositiveButton(getString(R.string.ok),
            new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    dialog.dismiss();
                }
            });
    alertDialog = builder.create();
    alertDialog.show();

}

From source file:it.crs4.most.ehrlib.widgets.DvTextWidget.java

/**
 * Instantiates a new {@link DvTextWidget}
 *
 * @param provider the widget provider/*w w  w  .j  a  v a  2 s  .  c  o  m*/
 * @param name the name of this widget
 * @param path the path of the {@link DvText} mapped on this widget
 * @param attributes the attributes of the {@link DvText} mapped on this widget
 * @param parentIndex the parent index
 */
public DvTextWidget(WidgetProvider provider, String name, String path, JSONObject attributes, int parentIndex) {
    super(provider, name, new DvText(path, attributes), parentIndex);

    LayoutInflater inflater = (LayoutInflater) _context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(R.layout.dv_text, null);

    _root_view = view;

    _title = (TextView) _root_view.findViewById(R.id.txt_title);
    _txtvalidity = (TextView) _root_view.findViewById(R.id.txt_validity);
    _input = (EditText) _root_view.findViewById(R.id.txt_text);

    _input.setMovementMethod(new ScrollingMovementMethod());

    this.updateLabelsContent();

    _help = (ImageView) _root_view.findViewById(R.id.image_help);

    toolTipRelativeLayout = (ToolTipRelativeLayout) _root_view
            .findViewById(R.id.activity_main_tooltipRelativeLayout);

    _help.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            if (myToolTipView == null) {
                myToolTipView = toolTipRelativeLayout.showToolTipForView(toolTip, _help);
                //myToolTipView.setOnToolTipViewClickedListener(DvTextWidget.this);
            } else {
                myToolTipView.remove();
                myToolTipView = null;

            }
        }
    });

}

From source file:de.tudresden.inf.rn.mobilis.groups.overlays.GroupsOverlay.java

@Override
protected boolean onTap(int index) {
    OverlayItem item = mOverlays.get(index);
    GroupItemInfo gii = groupItemInfos.get(index);

    LayoutInflater inflater = (LayoutInflater) mainActivity
            .getSystemService(mainActivity.LAYOUT_INFLATER_SERVICE);
    View layout = inflater.inflate(R.layout.groups_details_dialog,
            (ViewGroup) mainActivity.findViewById(R.id.groups_details_layout_root));

    TextView text = (TextView) layout.findViewById(R.id.groups_details_text);
    text.setText(Html.fromHtml("<b>Latitude:</b> " + gii.latitudeE6 / 1E6 + "<br><b>Longitude:</b> "
            + gii.longitudeE6 / 1E6 + "<br><b>Number of Members:</b> " + gii.memberCount));

    //Prepare the Intent for creating a group at this foursquare venue
    final Intent i = new Intent(mainActivity.getApplicationContext(), GroupInfoActivity.class);
    i.putExtra("group_id", gii.groupId);

    String title = gii.name;//from   w  w  w.  j  a  v  a 2  s  .c  o m
    if (title == null || title.equals(""))
        title = " ";
    AlertDialog.Builder builder = new AlertDialog.Builder(mainActivity);
    builder.setTitle(title).setView(layout).setIcon(R.drawable.group_marker_24).setCancelable(true)
            .setPositiveButton("Details", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    mainActivity.startActivity(i);
                }
            }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    dialog.cancel();
                }
            });
    builder.show();
    return true;
}

From source file:com.huishen_app.zc.ui.fragment.UserCenterFragment.java

@SuppressLint("InflateParams")
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    try {/*from  www .  jav  a2  s. c  om*/
        this_lay = inflater.inflate(R.layout.user_center, null);
        findViewById_Init();
        initView();

    } catch (Exception e) {
        e.printStackTrace();
    }
    return this_lay;
}

From source file:io.coldstart.android.EditOIDActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_edit_oid);

    // Show the Up button in the action bar.
    getActionBar().setDisplayHomeAsUpEnabled(true);

    oidDescList = (LinearLayout) findViewById(R.id.OIDDescriptionHolder);

    //((TextView) findViewById(R.id.textView)).setText(getIntent().getStringExtra("payload"));
    JSONObject oidDescriptions = null;/*from www  .ja va  2 s.c  om*/
    int i = 0;
    try {
        oidDescriptions = new JSONObject(getIntent().getStringExtra("payload"));

        Iterator<String> iter = oidDescriptions.keys();
        while (iter.hasNext()) {
            String key = iter.next();
            try {
                LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);

                View convertView = inflater.inflate(R.layout.oid_edit, null);

                ((TextView) convertView.findViewById(R.id.OID)).setText(key);
                ((EditText) convertView.findViewById(R.id.OIDDescription))
                        .setText((String) oidDescriptions.get(key));
                ((EditText) convertView.findViewById(R.id.OIDDescription)).setTag("e_" + key);

                ((Button) convertView.findViewById(R.id.submitDescriptionButton)).setTag(key);
                ((Button) convertView.findViewById(R.id.submitDescriptionButton))
                        .setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(final View view) {
                                //Log.e("onClick", ((EditText) ((View) oidDescList.findViewWithTag(view.getTag())).findViewWithTag("e_"+view.getTag())).getText().toString());

                                ((Thread) new Thread() {
                                    public void run() {
                                        try {
                                            if (api.submitOIDEdit((String) view.getTag(),
                                                    ((EditText) ((View) oidDescList
                                                            .findViewWithTag(view.getTag()))
                                                                    .findViewWithTag("e_" + view.getTag()))
                                                                            .getText().toString())) {
                                                runOnUiThread(new Runnable() {
                                                    public void run() {
                                                        Toast.makeText(getApplicationContext(),
                                                                "OID suggestion successful.",
                                                                Toast.LENGTH_SHORT).show();
                                                    }
                                                });
                                            } else {
                                                runOnUiThread(new Runnable() {
                                                    public void run() {
                                                        Toast.makeText(getApplicationContext(),
                                                                "OID suggestion was not successful.",
                                                                Toast.LENGTH_SHORT).show();
                                                    }
                                                });
                                            }
                                        } catch (Exception e) {
                                            e.printStackTrace();
                                        }
                                    }
                                }).start();
                            }
                        });
                convertView.setTag(key);
                oidDescList.addView(convertView);
                i++;
            } catch (Exception e) {
                // Something went wrong!
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:com.smartx.bill.mepad.mestore.uimgloader.AbsListViewBaseActivity.java

protected void setDialog() {
    dialog = new ProgressDialog(this, R.style.welcome_dialog);
    dialog.setCancelable(false);/*from w w  w  . ja  v  a 2  s. c o  m*/
    dialog.show();
    LayoutInflater inflater = LayoutInflater.from(this);
    View v = inflater.inflate(R.layout.wlecome_dialog, null);// view
    LinearLayout layout = (LinearLayout) v.findViewById(R.id.dialog_view);// 
    // main.xmlImageView
    ImageView spaceshipImage = (ImageView) v.findViewById(R.id.img);
    TextView tipTextView = (TextView) v.findViewById(R.id.tipTextView);// ??
    // 
    Animation hyperspaceJumpAnimation = AnimationUtils.loadAnimation(this, R.anim.loading_animation);
    // ImageView
    spaceshipImage.startAnimation(hyperspaceJumpAnimation);
    // tipTextView.setText(msg);// ?
    dialog.setContentView(layout);
}

From source file:it.crs4.most.ehrlib.widgets.DvCodedTextWidget.java

/**
 * Instantiates a new {@link DvCodedTextWidget}
 *
 * @param provider the widget provider/* w  ww .j ava 2s .  c  o m*/
 * @param name the name of this widget
 * @param path the path of the {@link DvCodedText} mapped on this widget
 * @param attributes the attributes of the {@link DvCodedText} mapped on this widget
 * @param parentIndex the parent index
 */
public DvCodedTextWidget(WidgetProvider provider, String name, String path, JSONObject attributes,
        int parentIndex) {
    super(provider, name, new DvCodedText(path, attributes), parentIndex);

    LayoutInflater inflater = (LayoutInflater) _context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(R.layout.dv_coded_text, null);
    _root_view = view;

    txtTitle = (TextView) _root_view.findViewById(R.id.txt_title);
    this.setupSpinner();

    this.updateLabelsContent();

    _help = (ImageView) _root_view.findViewById(R.id.image_help);

    toolTipRelativeLayout = (ToolTipRelativeLayout) _root_view
            .findViewById(R.id.activity_main_tooltipRelativeLayout);

    _help.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            if (myToolTipView == null) {
                myToolTipView = toolTipRelativeLayout.showToolTipForView(toolTip, _help);
                //myToolTipView.setOnToolTipViewClickedListener(DvTextWidget.this);
            } else {
                myToolTipView.remove();
                myToolTipView = null;
            }
        }
    });

}