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.mdlive.myhealth.ProviderDetailsFragment.java

@Nullable
@Override/*from ww w . j a  v a 2 s .  c  o  m*/
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    return inflater.inflate(R.layout.provider_details_fragment, null, false);
}

From source file:com.paranoid.gerrit.PatchSetViewerFragment.java

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

From source file:es.uniovi.imovil.fcrtrainer.BinaryExerciseFragment.java

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

    rootView = inflater.inflate(R.layout.fragment_binary, container, false);

    /**/*from w w w  . j  a  v a2s  .  com*/
     * Set Listener
     * **/
    Button check = (Button) rootView.findViewById(R.id.checkbutton);
    check.setOnClickListener(this);

    Button solution = (Button) rootView.findViewById(R.id.seesolution);
    solution.setOnClickListener(this);

    Button change = (Button) rootView.findViewById(R.id.change);
    change.setOnClickListener(this);

    newQuestion();

    return rootView;
}

From source file:io.indy.seni.ui.EvolveGridFragment.java

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

    final View v = inflater.inflate(R.layout.fragment_evolve, container, false);

    mGridView = (GridView) v.findViewById(R.id.gridView);
    mGridView.setAdapter(mAdapter);/*from   w  ww  .  j a  va2  s  .com*/
    mGridView.setOnItemClickListener(this);
    mGridView.setOnScrollListener(new AbsListView.OnScrollListener() {
        @Override
        public void onScrollStateChanged(AbsListView absListView, int scrollState) {
            // Pause fetcher to ensure smoother scrolling when flinging
            if (scrollState == AbsListView.OnScrollListener.SCROLL_STATE_FLING) {

            } else {
                mImageGenerator.setPauseWork(false);
            }
        }

        @Override
        public void onScroll(AbsListView absListView, int firstVisibleItem, int visibleItemCount,
                int totalItemCount) {
        }
    });

    mGridView.setChoiceMode(GridView.CHOICE_MODE_MULTIPLE_MODAL);
    mGridView.setMultiChoiceModeListener(mMultiChoiceModeListener);

    // This listener is used to get the final width of the GridView and then calculate the
    // number of columns and the width of each column. The width of each column is variable
    // as the GridView has stretchMode=columnWidth. The column width is used to set the height
    // of each view so we get nice square thumbnails.
    mGridView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
        @Override
        public void onGlobalLayout() {
            if (mAdapter.getNumColumns() == 0) {
                final int numColumns = (int) Math
                        .floor(mGridView.getWidth() / (mImageThumbSize + mImageThumbSpacing));
                if (numColumns > 0) {
                    final int columnWidth = (mGridView.getWidth() / numColumns) - mImageThumbSpacing;
                    mAdapter.setNumColumns(numColumns);
                    mAdapter.setItemHeight(columnWidth);
                    if (BuildConfig.DEBUG) {
                        Log.d(TAG, "onCreateView - numColumns set to " + numColumns);
                    }
                    if (AppConfig.hasJellyBean()) {
                        mGridView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
                    } else {
                        mGridView.getViewTreeObserver().removeGlobalOnLayoutListener(this);
                    }
                }
            }
        }
    });

    return v;
}

From source file:com.adamkruger.myipaddressinfo.IPAddressInfoFragment.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override//from   w  w w. j ava 2 s . co m
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_ip_address_info, container, false);
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
        ((TextView) rootView.findViewById(R.id.ipValue)).setTextIsSelectable(true);
        ((TextView) rootView.findViewById(R.id.ispValue)).setTextIsSelectable(true);
        ((TextView) rootView.findViewById(R.id.countryValue)).setTextIsSelectable(true);
        ((TextView) rootView.findViewById(R.id.cityValue)).setTextIsSelectable(true);
        ((TextView) rootView.findViewById(R.id.regionValue)).setTextIsSelectable(true);
        ((TextView) rootView.findViewById(R.id.coordinatesValue)).setTextIsSelectable(true);
    }
    rootView.findViewById(R.id.coordinatesValue).setOnClickListener(this);
    mDefaultLastUpdateTimeColor = ((TextView) rootView.findViewById(R.id.lastUpdateTime)).getTextColors()
            .getDefaultColor();
    return rootView;
}

From source file:com.citrus.sdk.fragments.SavedOptions.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    returnView = inflater.inflate(R.layout.activity_saved_options, container, false);
    listener = new JSONTaskComplete() {

        @Override/*from ww w .  j a va  2  s  . c  om*/
        public void onTaskExecuted(JSONObject[] returnObject, String message) {
            progressBar.setVisibility(View.INVISIBLE);
            if (TextUtils.equals(message, "success")) {
                initViews();
                try {
                    storePayOptions(returnObject[1]);
                    showPayOptions();
                } catch (Exception e) {
                    return;
                }
            } else {
                Logout.logoutUser(getActivity());
                showSignInFlow("User not signed in");
            }
        }

    };

    signInListener = new JSONTaskComplete() {

        @Override
        public void onTaskExecuted(JSONObject[] paymentObject, String message) {
            progressBar.setVisibility(View.INVISIBLE);
            if (TextUtils.equals(message, "signedIn")) {
                showSavedOptions();
            } else {
                showSignInFlow("User not signed in");
            }
        }
    };

    showSavedOptions();
    return returnView;
}

From source file:com.bullmobi.message.ui.components.NotifyWidget.java

@Override
protected ViewGroup onCreateView(@NonNull LayoutInflater inflater, @NonNull ViewGroup container,
        @Nullable ViewGroup sceneView) {
    boolean initialize = sceneView == null;
    if (initialize) {
        sceneView = (ViewGroup) inflater.inflate(R.layout.easynotification_scene_notification, container,
                false);//from   w  ww .  j  ava  2 s .  c  o  m
        assert sceneView != null;
    }

    mNotifyWidget = (NotificationWidget) sceneView.findViewById(R.id.notification);

    if (!initialize) {
        return sceneView;
    }

    mNotifyWidget.setCallback(mWidgetCallback);
    return sceneView;
}

From source file:com.jaguarlandrover.auto.remote.vehicleentry.LockActivityFragment.java

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

    View view = inflater.inflate(R.layout.fragment_lock, container, false);
    sharedPref = PreferenceManager.getDefaultSharedPreferences(getActivity());

    Typeface fontawesome = Typeface.createFromAsset(getActivity().getAssets(), "fonts/fontawesome-webfont.ttf");

    lock = (ImageButton) view.findViewById(R.id.lock);
    unlock = (ImageButton) view.findViewById(R.id.unlock);
    trunk = (ImageButton) view.findViewById(R.id.trunk);
    find = (ImageButton) view.findViewById(R.id.find);
    start = (ImageButton) view.findViewById(R.id.start);
    stop = (ImageButton) view.findViewById(R.id.stop);
    panic = (ImageButton) view.findViewById(R.id.panic);
    share = (ImageButton) view.findViewById(R.id.share);
    change = (ImageButton) view.findViewById(R.id.change);
    keylbl = (TextView) view.findViewById(R.id.keysharelbl);
    validDate = (TextView) view.findViewById(R.id.guestvalidDate);
    validTime = (TextView) view.findViewById(R.id.guestvalidTime);
    userHeader = (TextView) view.findViewById(R.id.user_header);
    vehicleHeader = (TextView) view.findViewById(R.id.vehicle_header);
    keyManagementLayout = (LinearLayout) view.findViewById(R.id.key_management_layout);
    //        panicOn = (Button) view.findViewById(R.id.panicOn);

    UserCredentials userCredentials = ServerNode.getUserCredentials();

    if (userCredentials == null) {
        setButtons(new UserCredentials());
    } else {/*from   ww w  .  j av a 2  s .  c om*/
        setButtons(userCredentials);
    }

    buttonSet = new Handler();
    startRepeatingTask();

    lock.setOnClickListener(l);
    unlock.setOnClickListener(l);
    trunk.setOnClickListener(l);
    find.setOnClickListener(l);
    start.setOnClickListener(l);
    stop.setOnClickListener(l);
    panic.setOnClickListener(l);
    share.setOnClickListener(l);
    change.setOnClickListener(l);
    //        panicOn.setOnClickListener(l);

    buttonListener = (LockFragmentButtonListener) getActivity();
    return view;
}

From source file:com.achep.acdisplay.ui.components.NotifyWidget.java

@Override
protected ViewGroup onCreateView(@NonNull LayoutInflater inflater, @NonNull ViewGroup container,
        @Nullable ViewGroup sceneView) {
    boolean initialize = sceneView == null;
    if (initialize) {
        sceneView = (ViewGroup) inflater.inflate(R.layout.acdisplay_scene_notification, container, false);
        assert sceneView != null;
    }//  w ww  .  ja v a 2  s  .c o m

    mNotifyWidget = (NotificationWidget) sceneView.findViewById(R.id.notification);

    if (!initialize) {
        return sceneView;
    }

    mNotifyWidget.setCallback(mWidgetCallback);
    return sceneView;
}

From source file:com.krayzk9s.imgurholo.ui.CommentsFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    View view = inflater.inflate(R.layout.account_layout, container, false);
    LinearLayout headerLayout = (LinearLayout) view.findViewById(R.id.header);
    headerLayout.setVisibility(View.GONE);
    errorText = (TextView) view.findViewById(R.id.error);
    mDrawerList = (ListView) view.findViewById(R.id.account_list);
    ImgurHoloActivity activity = (ImgurHoloActivity) getActivity();
    SharedPreferences settings = activity.getApiCall().settings;
    if (settings.getString("theme", MainActivity.HOLO_LIGHT).equals(MainActivity.HOLO_LIGHT))
        commentsAdapter = new MessageAdapter(activity, R.layout.comment_layout);
    else/*ww  w.j  a va2s . c o m*/
        commentsAdapter = new MessageAdapter(activity, R.layout.comment_layout_dark);
    String[] mMenuList = getResources().getStringArray(R.array.emptyList);
    ArrayAdapter<String> tempAdapter;
    if (settings.getString("theme", MainActivity.HOLO_LIGHT).equals(MainActivity.HOLO_LIGHT))
        tempAdapter = new ArrayAdapter<String>(activity, R.layout.comment_layout, mMenuList);
    else
        tempAdapter = new ArrayAdapter<String>(activity, R.layout.comment_layout_dark, mMenuList);
    mDrawerList.setAdapter(tempAdapter);
    if (savedInstanceState == null) {
        getComments();
    } else {
        commentDataArray = savedInstanceState.getParcelableArrayList("content");
        commentsAdapter.addAll(commentDataArray);
        mDrawerList.setAdapter(commentsAdapter);
        commentsAdapter.notifyDataSetChanged();
    }
    return view;
}