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.aikidonord.fragments.FragmentLieu.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    View view = inflater.inflate(R.layout.fragment_lieu, null /*container, false*/);

    View rlLoading = view.findViewById(R.id.loadingPanel);
    //View listView = view.getListView();

    if (VerifConnexion.isOnline(this.getActivity())) {
        rlLoading.setVisibility(View.VISIBLE);

        // on va fair l'impasse l dessus vu que je ne suis pas bien sr
        // de la manire dont il faut oprer tant que la vue n'a pas t renvoye.
        //listView.setVisibility(View.GONE);
        this.lancementAsync();
    } else {//from w w w .  ja  v a2  s  .  co m

        AlertDialog alertDialog = new AlertDialog.Builder(this.getActivity()).create();
        alertDialog.setTitle(getResources().getString(R.string.app_name));
        alertDialog.setMessage(getResources().getString(R.string.no_network));
        alertDialog.setIcon(R.drawable.ic_launcher);
        alertDialog.setCancelable(false);
        alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, getResources().getString(R.string.close),
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        // if this button is clicked, close
                        // current activity
                        FragmentLieu.this.getActivity().finish();
                    }
                });
        alertDialog.show();
    }

    return view;
}

From source file:com.aikidonord.fragments.FragmentType.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    View view = inflater.inflate(R.layout.fragment_type, null /*container, false*/);

    View rlLoading = view.findViewById(R.id.loadingPanel);
    //View listView = view.getListView();

    if (VerifConnexion.isOnline(this.getActivity())) {
        rlLoading.setVisibility(View.VISIBLE);

        // on va fair l'impasse l dessus vu que je ne suis pas bien sr
        // de la manire dont il faut oprer tant que la vue n'a pas t renvoye.
        //listView.setVisibility(View.GONE);
        this.lancementAsync();
    } else {/*from   ww w.j a  va2  s.co  m*/

        AlertDialog alertDialog = new AlertDialog.Builder(this.getActivity()).create();
        alertDialog.setTitle(getResources().getString(R.string.app_name));
        alertDialog.setMessage(getResources().getString(R.string.no_network));
        alertDialog.setIcon(R.drawable.ic_launcher);
        alertDialog.setCancelable(false);
        alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, getResources().getString(R.string.close),
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        // if this button is clicked, close
                        // current activity
                        FragmentType.this.getActivity().finish();
                    }
                });
        alertDialog.show();
    }

    return view;
}

From source file:li.barter.fragments.ReportBugFragment.java

@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
        final Bundle savedInstanceState) {
    init(container, savedInstanceState);
    setActionBarTitle(R.string.Report_fragment_title);
    final View view = inflater.inflate(R.layout.fragment_report_bug, null);
    mReportedBugTextView = (EditText) view.findViewById(R.id.text_bug_description);
    mDeviceInfoTextView = (EditText) view.findViewById(R.id.text_device_description);
    mReportBugSelect = (RadioButton) view.findViewById(R.id.radio_reportbug);
    mReportSuggestionSelect = (RadioButton) view.findViewById(R.id.radio_suggestfeature);

    mReportSuggestionSelect.setOnCheckedChangeListener(this);
    mReportSuggestionSelect.setChecked(true);
    mReportBugButton = (Button) view.findViewById(R.id.button_report_bug);
    mReportBugButton.setOnClickListener(this);
    return view;/*  w w  w . j a v  a  2 s  . com*/
}

From source file:gov.wa.wsdot.android.wsdot.ui.FerriesRouteSchedulesDaySailingsFragment.java

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

    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_list_with_spinner, null);

    // For some reason, if we omit this, NoSaveStateFrameLayout thinks we are
    // FILL_PARENT / WRAP_CONTENT, making the progress bar stick to the top of the activity.
    root.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    mLoadingSpinner = root.findViewById(R.id.loading_spinner);

    return root;//from  w w w .jav a 2 s. c o m
}

From source file:com.insthub.O2OMobile.Activity.F9_SettingActivity.java

private void showDialog() {
    LayoutInflater inflater = LayoutInflater.from(this);
    View view = inflater.inflate(R.layout.photo_dialog, null);
    mDialog = new Dialog(this, R.style.dialog);
    mDialog.setContentView(view);//from  w ww  .java2  s.  com

    mDialog.setCanceledOnTouchOutside(true);
    mDialog.show();
    LinearLayout requsetCameraLayout = (LinearLayout) view.findViewById(R.id.register_camera);
    LinearLayout requestPhotoLayout = (LinearLayout) view.findViewById(R.id.register_photo);

    requsetCameraLayout.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            mDialog.dismiss();
            if (mFileDir == null) {
                mFileDir = new File(O2OMobileAppConst.FILEPATH + "img/");
                if (!mFileDir.exists()) {
                    mFileDir.mkdirs();
                }
            }
            mFileName = O2OMobileAppConst.FILEPATH + "img/" + "temp.jpg";
            mFile = new File(mFileName);
            Uri imageuri = Uri.fromFile(mFile);
            Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
            intent.putExtra(MediaStore.EXTRA_OUTPUT, imageuri);
            intent.putExtra("return-data", false);
            startActivityForResult(intent, REQUEST_CAMERA);
        }
    });

    requestPhotoLayout.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            mDialog.dismiss();
            Intent picture = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
            startActivityForResult(picture, REQUEST_PHOTO);

        }
    });
}

From source file:fr.mdk.kisspush.KISSPush.java

protected void openAdd() {
    final Activity act = this;
    // get prompts.xml view
    LayoutInflater layoutInflater = getLayoutInflater();
    View promptView = layoutInflater.inflate(R.layout.prompts, null);
    AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(act);
    // set prompts.xml to be the layout file of the alertdialog
    // builder/*from  w w w . j a v a2 s  .  c o m*/
    alertDialogBuilder.setView(promptView);
    final EditText input = (EditText) promptView.findViewById(R.id.userInput);
    // setup a dialog window
    alertDialogBuilder.setCancelable(false).setPositiveButton("OK", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
            // get user input and set it to
            // result
            if (input.getText().toString().length() > 0) {
                kiss_push_cli.add_alias(input.getText().toString(), new JsonHttpResponseHandler() {
                    @Override
                    public void onSuccess(int arg0, Header[] arg1, byte[] arg2) {
                        getAliases();
                    }
                });
            }
        }
    }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
            dialog.cancel();
        }
    });
    // create an alert dialog
    AlertDialog alertD = alertDialogBuilder.create();
    alertD.show();

}

From source file:com.firesoft.member.Activity.C1_PublishOrderActivity.java

public void initData() {
    Date date = new Date();
    mTime.setText(mFormat.format(date));
    mTime.setOnClickListener(new View.OnClickListener() {

        @Override//from  www  .  ja v  a 2 s . co m
        public void onClick(View v) {
            // TODO Auto-generated method stub
            CloseKeyBoard();
            LayoutInflater inflater = LayoutInflater.from(C1_PublishOrderActivity.this);
            final View timepickerview = inflater.inflate(R.layout.timepicker, null);
            ScreenInfo screenInfo = new ScreenInfo(C1_PublishOrderActivity.this);
            mWheelMain = new WheelMain(timepickerview);
            mWheelMain.screenheight = screenInfo.getHeight();
            Calendar calendar = Calendar.getInstance();
            try {
                calendar.setTime(mFormat.parse(mTime.getText().toString()));
            } catch (ParseException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            int year = calendar.get(Calendar.YEAR);
            int month = calendar.get(Calendar.MONTH);
            int day = calendar.get(Calendar.DAY_OF_MONTH);
            int hour = calendar.get(Calendar.HOUR_OF_DAY);
            int min = calendar.get(Calendar.MINUTE);
            mWheelMain.initDateTimePicker(year, month, day, hour, min);
            new AlertDialog.Builder(C1_PublishOrderActivity.this).setTitle("")
                    .setView(timepickerview)
                    .setPositiveButton(getString(R.string.confirm), new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            mTime.setText(mWheelMain.getTime());
                        }
                    }).setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                        }
                    }).show();
        }
    });
}

From source file:com.insthub.O2OMobile.Activity.F0_ProfileActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.f0_profile);
    mUserId = getIntent().getIntExtra(USER_ID, 0);
    mServiceType = (SERVICE_TYPE) getIntent().getSerializableExtra(O2OMobileAppConst.SERVICE_TYPE);
    mListview = (ListView) findViewById(R.id.profile_listview);
    mHelp = (Button) findViewById(R.id.btn_help);
    LayoutInflater layoutInflater = LayoutInflater.from(this);
    mHeaderView = layoutInflater.inflate(R.layout.f0_profile_header, null);
    mBack = (ImageView) mHeaderView.findViewById(R.id.top_view_back);
    mSetting = (ImageView) mHeaderView.findViewById(R.id.top_view_setting);
    mAvatar = (RoundedWebImageView) mHeaderView.findViewById(R.id.iv_avarta);
    mName = (TextView) mHeaderView.findViewById(R.id.tv_name);
    mBalance = (TextView) mHeaderView.findViewById(R.id.tv_balance);
    mSignature = (TextView) mHeaderView.findViewById(R.id.tv_signature);
    mBrief = (TextView) mHeaderView.findViewById(R.id.tv_brief);
    mBrief_detail = (TextView) mHeaderView.findViewById(R.id.brief_detail);
    //        mMyCash = (RelativeLayout) mHeaderView.findViewById(R.id.my_cash);
    mComment = (RelativeLayout) mHeaderView.findViewById(R.id.comment);
    mCommentCount = (TextView) mHeaderView.findViewById(R.id.tv_comment_count);
    mCommentGoodrate = (TextView) mHeaderView.findViewById(R.id.tv_comment_goodrate);
    mComplain = (TextView) mHeaderView.findViewById(R.id.complain);
    mGridviewServiceList = (MyGridView) mHeaderView.findViewById(R.id.grid_view_service_list);
    mGridview = (LinearLayout) mHeaderView.findViewById(R.id.gridview);
    mBirefLayout = (LinearLayout) mHeaderView.findViewById(R.id.ll_brief);
    mRefresh = (ImageView) mHeaderView.findViewById(R.id.refresh);
    mGridviewServiceList.setSelector(new ColorDrawable(Color.TRANSPARENT));
    mListview.addHeaderView(mHeaderView);
    mListview.setAdapter(null);//from ww w.j  a v  a2s  . c  o m
    mUserBalance = new UserBalanceModel(this);
    mUserBalance.addResponseListener(this);
    mUserBalance.getProfile(mUserId);
    mBack.setOnClickListener(this);
    mSetting.setOnClickListener(this);
    mBrief_detail.setOnClickListener(this);
    mHelp.setOnClickListener(this);
    mComment.setOnClickListener(this);
    mComplain.setOnClickListener(this);
    mAvatar.setOnClickListener(this);
    mRefresh.setOnClickListener(this);
    if (mUserId != SESSION.getInstance().uid) {
        mSetting.setVisibility(View.GONE);
        mComplain.setVisibility(View.VISIBLE);
    } else {
        mUserBalance.get();
    }
    EventBus.getDefault().register(this);
}

From source file:com.github.rutvijkumar.twittfuse.fragments.ComposeDialog.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Dialog dialog = getDialog();/*from www .  j a  va 2s.  c  o  m*/
    Window window = dialog.getWindow();
    View view = inflater.inflate(R.layout.compose_dialog, container);
    window.requestFeature(Window.FEATURE_NO_TITLE);
    window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    window.setLayout(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    setUpUI(view);
    getUserAccountDetails();
    return view;
}