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:org.mifos.androidclient.util.listadapters.SimpleExpandableListAdapter.java

@Override
public View getGroupView(int groupPos, boolean isExpanded, View convertView, ViewGroup parent) {
    View row;//w  w w .  j a v  a 2  s. c  o m
    if (convertView == null) {
        LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        row = inflater.inflate(R.layout.simple_list_group, parent, false);
    } else {
        row = convertView;
    }
    SimpleListItem item = (SimpleListItem) getGroup(groupPos);
    if (item != null) {
        TextView label = (TextView) row.findViewById(R.id.simple_list_item_label);
        if (getChildrenCount(groupPos) > 0) {
            label.setText(mContext.getString(R.string.clientsList_listGroupLabel_withChildren,
                    item.getListLabel(), getChildrenCount(groupPos)));
        } else {
            label.setText(item.getListLabel());
        }
    }
    synchronized (mExpandGroups) {
        if (mExpandGroups == true) {
            ExpandableListView list = (ExpandableListView) parent;
            list.expandGroup(groupPos);
        }
    }
    return row;
}

From source file:com.example.administrator.myapplication2._4_Detail.RightFragment.java

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

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

    Intent myIntent = getActivity().getIntent();
    if (myIntent != null) {
        seq = myIntent.getStringExtra("seq");
    }//w ww . ja  v  a 2 s . com

    SharedPreferences myPrefs = this.getActivity().getSharedPreferences("login", Context.MODE_PRIVATE);
    if ((myPrefs != null) && (myPrefs.contains("id"))) {
        id = myPrefs.getString("id", "");
    }

    // ? ? 
    map = ((SupportMapFragment) getChildFragmentManager().findFragmentById(R.id.map2)).getMap();

    // Setting a custom info window adapter for the google map
    map.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() {

        // Use default InfoWindow frame
        @Override
        public View getInfoWindow(Marker arg0) {
            return null;
        }

        // Defines the contents of the InfoWindow
        @Override
        public View getInfoContents(Marker arg0) {

            return null;

        }
    });

    map.setMyLocationEnabled(true);

    arrayPoints = new ArrayList<LatLng>();

    getRecentData();

    /*
            
    if(arrayPoints.size()>0){ showExrLocation(arrayPoints);}                           //Gps
    //if(arrayPoints_network.size()>0){ showExrLocation_network(arrayPoints_network); } //? Gps
    else{Log.i("boogil","? 0?");}
    */

    return rootView;
}

From source file:com.towerlabs.yildizyemek.ViewPagerDinner.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // TODO Auto-generated method stub

    view = inflater.inflate(R.layout.activity_viewpager_dinner, container, false);

    try {/* ww w . ja  v  a 2s . co  m*/
        initComponents(view);
    } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (ExecutionException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (JSONException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (ParseException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (LastDayException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    return view;
}

From source file:com.microsoft.onedrive.apiexplorer.DeltaFragment.java

@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
        final Bundle savedInstanceState) {
    final View view = inflater.inflate(R.layout.fragment_json_view, container, false);
    ((TextView) view.findViewById(R.id.json)).setMovementMethod(new ScrollingMovementMethod());
    getActivity().setTitle(getString(R.string.delta_title, mItemName));

    refresh();/*from  ww  w  .  j  av a 2 s.c o  m*/
    return view;
}

From source file:app.hacked.ProjectDetailsFragment.java

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

    ((TextView) rootView.findViewById(R.id.Title)).setText(Name);
    ((TextView) rootView.findViewById(R.id.Title))
            .setTypeface(Typeface.create("sans-serif-light", Typeface.NORMAL));

    /*((TextView) rootView.findViewById(R.id.TeamMembers)).setText(TeamMembers);
    ((TextView) rootView.findViewById(R.id.TeamMembers)).setTypeface(Typeface.create("sans-serif-condensed", Typeface.NORMAL));*/

    ((TextView) rootView.findViewById(R.id.Tech)).setText(Technologies);
    ((TextView) rootView.findViewById(R.id.Tech))
            .setTypeface(Typeface.create("sans-serif-condensed", Typeface.NORMAL));

    ((TextView) rootView.findViewById(R.id.Description)).setText(Html.fromHtml(Description));
    ((TextView) rootView.findViewById(R.id.Description))
            .setTypeface(Typeface.create("sans-serif", Typeface.NORMAL));

    ((Button) rootView.findViewById(R.id.VoteUp)).setOnClickListener(new View.OnClickListener() {
        @Override//from  w w w. j a v  a 2  s. c om
        public void onClick(View view) {
            doVote(true);
        }
    });

    ((Button) rootView.findViewById(R.id.VoteDown)).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            doVote(false);
        }
    });

    ((Button) rootView.findViewById(R.id.EditProject)).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            startActivity(new Intent(Intent.ACTION_VIEW,
                    Uri.parse("https://www.hackerleague.org/hackathons/hacked/hacks")));
        }
    });

    return rootView;
}

From source file:com.achep.acdisplay.acdisplay.components.NotificationUI.java

@Override
protected ViewGroup onCreateExpandedView(LayoutInflater inflater, ViewGroup container, ViewGroup sceneView) {
    boolean initialize = sceneView == null;
    if (initialize) {
        sceneView = (ViewGroup) inflater.inflate(R.layout.acdisplay_scene_notification, container, false);
        assert sceneView != null;
    }//from   w ww. j  av a2s .  com

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

    if (!initialize) {
        return sceneView;
    }

    mNotifyWidget.setOnClickListener(new NotificationWidget.OnClickListener() {

        @Override
        public void onClick(View v) {
            final OpenStatusBarNotification osbn = mNotifyWidget.getNotification();
            if (osbn != null) {
                getHostFragment().showMainWidget();
                getHostFragment().unlock(new Runnable() {
                    @Override
                    public void run() {
                        osbn.click();
                    }
                }, false);
            }
        }

        @Override
        public void onActionButtonClick(View v, final PendingIntent pendingIntent) {
            getHostFragment().showMainWidget();
            getHostFragment().unlock(new Runnable() {
                @Override
                public void run() {
                    PendingIntentUtils.sendPendingIntent(pendingIntent);
                }
            }, false);
        }

    });

    return sceneView;
}

From source file:com.hybris.mobile.app.commerce.adapter.CategoryListPreferenceAdapter.java

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

    View rowView;/*from  w  w w.  ja v a  2 s  .  c  o m*/
    CategoryHierarchy category = getItem(position);

    if (convertView == null) {
        LayoutInflater inflater = (LayoutInflater) getContext()
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        rowView = inflater.inflate(R.layout.item_category_offline_pref, parent, false);
        rowView.setTag(new ViewHolder(rowView));
    } else {
        rowView = convertView;
    }

    final ViewHolder viewHolder = (ViewHolder) rowView.getTag();

    viewHolder.categoryName.setText(category.getName());
    viewHolder.category = category;
    viewHolder.position = position;
    viewHolder.checkbox.setChecked(getCheckedStatus(category.getId()));

    // We put a padding for the subcategories
    viewHolder.categoryName.setPadding(getNbParents(category) * 20, 0, 0, 0);

    return rowView;
}

From source file:com.mercandalli.android.apps.files.user.community.UserFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    this.mRootView = inflater.inflate(R.layout.fragment_user, container, false);
    this.mCircularProgressBar = (ProgressBar) mRootView.findViewById(R.id.circularProgressBar);
    this.mMessageTextView = (TextView) mRootView.findViewById(R.id.message);

    this.mRecyclerView = (RecyclerView) mRootView.findViewById(R.id.my_recycler_view);
    this.mRecyclerView.setHasFixedSize(true);
    final RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getActivity());
    this.mRecyclerView.setLayoutManager(layoutManager);
    this.mRecyclerView
            .setItemAnimator(/*new SlideInFromLeftItemAnimator(mRecyclerView)*/new DefaultItemAnimator());
    this.mRecyclerView
            .addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL_LIST));

    mRootView.findViewById(R.id.circle).setVisibility(View.GONE);

    mSwipeRefreshLayout = (SwipeRefreshLayout) mRootView.findViewById(R.id.swipeRefreshLayout);
    mSwipeRefreshLayout.setColorSchemeResources(android.R.color.holo_blue_bright,
            android.R.color.holo_green_light, android.R.color.holo_orange_light,
            android.R.color.holo_red_light);

    mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override//from   w w w .  j  a  v  a 2s  .  co  m
        public void onRefresh() {
            refreshList();
        }
    });

    refreshList();

    return mRootView;
}

From source file:com.memetro.android.settings.SettingsFragment.java

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

    View inflated = inflater.inflate(R.layout.fragment_settings, container, false);

    spinnerCity = (Spinner) inflated.findViewById(R.id.spinnerCity);
    spinnerCountry = (Spinner) inflated.findViewById(R.id.spinnerCountry);
    twitter = (EditText) inflated.findViewById(R.id.twitter_username);
    name = (EditText) inflated.findViewById(R.id.name);
    mail = (EditText) inflated.findViewById(R.id.email);
    checkNotifications = (CheckBox) inflated.findViewById(R.id.check_notifications);
    saveButton = (Button) inflated.findViewById(R.id.save_button);

    checkNotifications.setChecked(!UserPreferences.areNotificationsEnabled(mActivity));

    List<City> cities = DataUtils.getCities(DataUtils.getUserCountryId());

    userData = DataUtils.getUserData();/*w ww  .  ja  va 2s  . com*/
    if (!userData.twittername.equals("")) {
        twitter.setText("@" + userData.twittername);
    }
    if (!userData.name.equals("")) {
        name.setText(userData.name);
    }
    if (!userData.email.equals("")) {
        mail.setText(userData.email);
    }

    checkNotifications.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
            UserPreferences.toggleNotifications(mActivity, !checkNotifications.isChecked());
        }
    });

    List<Country> countries = DataUtils.getCountries();
    LayoutUtils.setDefaultSpinnerGrey(mActivity, spinnerCountry, countries);

    for (int i = 0; countries.size() > i; i++) {
        Country country = countries.get(i);
        if (country.countryId == DataUtils.getUserCountryId()) {
            spinnerCountry.setSelection(i);
        }
    }

    Long defaultUserCity = userData.cityId;

    LayoutUtils.setDefaultSpinner(mActivity, spinnerCity, cities);

    for (int i = 0; cities.size() > i; i++) {
        City city = cities.get(i);
        if (city.cityId == defaultUserCity) {
            spinnerCity.setSelection(i);
        }
    }

    spinnerCountry.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
            Country country = (Country) adapterView.getAdapter().getItem(i);
            Log.d("PAIS", country.name);
            List<City> cities = DataUtils.getCities(country.countryId);
            LayoutUtils.setDefaultSpinnerGrey(mActivity, spinnerCity, cities);
        }

        @Override
        public void onNothingSelected(AdapterView<?> adapterView) {

        }
    });

    saveButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            new AsyncEditData(mActivity, name.getText().toString(), mail.getText().toString(),
                    getCitySelected()).execute();
        }
    });

    return inflated;
}

From source file:com.opemind.cartspage.client.android.book.SearchBookContentsActivity.java

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    // Make sure that expired cookies are removed on launch.
    CookieSyncManager.createInstance(this);
    CookieManager.getInstance().removeExpiredCookie();

    Intent intent = getIntent();//from www.j  av  a  2 s  . com
    if (intent == null || !intent.getAction().equals(Intents.SearchBookContents.ACTION)) {
        finish();
        return;
    }

    isbn = intent.getStringExtra(Intents.SearchBookContents.ISBN);
    if (LocaleManager.isBookSearchUrl(isbn)) {
        setTitle(getString(R.string.sbc_name));
    } else {
        setTitle(getString(R.string.sbc_name) + ": ISBN " + isbn);
    }

    setContentView(R.layout.search_book_contents);
    queryTextView = (EditText) findViewById(R.id.query_text_view);

    String initialQuery = intent.getStringExtra(Intents.SearchBookContents.QUERY);
    if (initialQuery != null && !initialQuery.isEmpty()) {
        // Populate the search box but don't trigger the search
        queryTextView.setText(initialQuery);
    }
    queryTextView.setOnKeyListener(keyListener);

    queryButton = findViewById(R.id.query_button);
    queryButton.setOnClickListener(buttonListener);

    resultListView = (ListView) findViewById(R.id.result_list_view);
    LayoutInflater factory = LayoutInflater.from(this);
    headerView = (TextView) factory.inflate(R.layout.search_book_contents_header, resultListView, false);
    resultListView.addHeaderView(headerView);
}