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:com.achep.acdisplay.acdisplay.components.NotifyWidget.java

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

    mIconView = (NotificationIconWidget) view;
    mIconView.setNotification(mNotification);
    return view;/*ww w.  j  a v  a  2  s  .  co m*/
}

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

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

From source file:de.lebenshilfe_muenster.uk_gebaerden_muensterland.sign_trainer.SignTrainerPassiveFragment.java

@Nullable
@Override// w ww .j  a  v a2 s.c  o  m
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Log.d(TAG, "onCreateView " + hashCode());
    final View view = inflater.inflate(R.layout.trainer_passive_fragment, container, false);
    setHasOptionsMenu(true);
    initializeQuestionViews(view);
    initializeAnswerViews(view);
    initializeVideoViews(view);
    this.questionViews = new View[] { this.signQuestionText, this.videoView, this.solveQuestionButton };
    this.answerViews = new View[] { this.signAnswerTextView, this.signMnemonicTextView,
            this.signLearningProgressTextView, this.signHowHardWasQuestionTextView,
            this.signTrainerExplanationTextView, this.questionWasEasyButton, this.questionWasFairButton,
            this.questionWasHardButton };
    setVisibility(this.questionViews, View.VISIBLE);
    setVisibility(this.answerViews, View.GONE);
    return view;
}

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

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

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

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

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

    // other input fields
    editBaseURL = (EditText) v.findViewById(R.id.baseURL);
    editBaseURL.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.naman14.algovisualizer.AlgoDescriptionFragment.java

@Nullable
@Override/*from w ww. ja  va2  s . c  om*/
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
        @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_algo_description, container, false);

    rootView = (LinearLayout) view.findViewById(R.id.rootView);
    setCodeDesc(getArguments().getString(Algorithm.KEY_ALGORITHM));

    return view;
}

From source file:com.example.t_danbubbletea.MySelections.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_tea_selections, container, false);
    getActivity().setTitle("Tea Selections");
    // animation when enter home page
    rootView.startAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.image_click));
    //download the URL's asynchronously (put the info in the teaInfo object)
    try {// ww  w  .  j  av a 2 s.  co m
        teaInfo = new GetTeaInfoTask().execute(new ApiConnector()).get();
    } catch (InterruptedException e) {
        e.printStackTrace();
    } catch (ExecutionException e) {
        e.printStackTrace();
    }
    //make the gridview, set its adapter
    GridView gridView = (GridView) rootView.findViewById(R.id.grid_view_tea_selections);
    GridViewCustomAdapter gvAdapter = new GridViewCustomAdapter(getActivity(), teaInfo.imageURLs,
            teaInfo.teaNames);
    gridView.setAdapter(gvAdapter);
    //make the on click listeners
    gridView.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
            Fragment newFragment;
            switch (position) {
            default:
                Bundle teaViewArgs = new Bundle();
                teaViewArgs.putString("teaName", teaInfo.teaNames.get(position));
                teaViewArgs.putString("teaImgUrl", teaInfo.imageURLs.get(position));
                teaViewArgs.putString("teaDesc", teaInfo.teaDescriptions.get(position));
                newFragment = new TeaViewFragment();
                newFragment.setArguments(teaViewArgs);
                break;

            }
            if (newFragment != null) {
                flipCard(newFragment);
            }
        }

        private void flipCard(Fragment newFragment) {
            mShowingBack = true;
            FragmentManager fragmentManager = getFragmentManager();
            fragmentManager.beginTransaction()
                    .setCustomAnimations(R.anim.card_flip_right_in, R.anim.card_flip_right_out,
                            R.anim.card_flip_left_in, R.anim.card_flip_left_out)
                    .replace(R.id.frame_container, newFragment).addToBackStack(null).commit(); // create new fragment and allow user to go back to previous fragment          
        }
    });
    return rootView;
}

From source file:org.mifos.androidclient.util.listadapters.SimpleListAdapter.java

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    View row;/*from ww  w  .  j  av a  2  s  .co  m*/
    if (convertView == null) {
        LayoutInflater inflater = (LayoutInflater) getContext()
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        row = inflater.inflate(R.layout.simple_list_item, parent, false);
    } else {
        row = convertView;
    }
    SimpleListItem item = getItem(position);
    if (item != null) {
        TextView label = (TextView) row.findViewById(R.id.simple_list_item_label);
        label.setText(item.getListLabel());
    }
    return row;
}

From source file:com.chaosinmotion.securechat.fragments.OnboardingForgotPassword.java

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

From source file:com.example.run_tracker.LoginFragment.java

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

    View rootView = inflater.inflate(R.layout.loginfragment, container, false);
    mLogin = (Button) rootView.findViewById(R.id.login);
    mUsername = (EditText) rootView.findViewById(R.id.username);
    mPassword = (EditText) rootView.findViewById(R.id.password);
    mRememberme = (CheckBox) rootView.findViewById(R.id.rememberme);
    mLogin.setOnClickListener(this);
    SharedPreferences credentials = getActivity().getPreferences(Context.MODE_PRIVATE);
    mUsername.setText(credentials.getString("username", ""));
    mPassword.setText(credentials.getString("password", ""));
    return rootView;

}

From source file:org.deviceconnect.android.uiapp.fragment.profile.VibrationProfileFragment.java

@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
        final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    View view = inflater.inflate(R.layout.fragment_vibration_service, container, false);
    view.setBackgroundColor(getResources().getColor(android.R.color.background_light));

    final TextView pattern = (TextView) view.findViewById(R.id.fragment_vibration_pattern);

    Button btn = (Button) view.findViewById(R.id.fragment_vibration_send);
    btn.setOnClickListener(new OnClickListener() {
        @Override//from  w  ww .j  a  v a 2s.c o m
        public void onClick(final View v) {
            sendVibration(pattern.getText());
        }
    });
    return view;
}