Example usage for android.content Context LAYOUT_INFLATER_SERVICE

List of usage examples for android.content Context LAYOUT_INFLATER_SERVICE

Introduction

In this page you can find the example usage for android.content Context LAYOUT_INFLATER_SERVICE.

Prototype

String LAYOUT_INFLATER_SERVICE

To view the source code for android.content Context LAYOUT_INFLATER_SERVICE.

Click Source Link

Document

Use with #getSystemService(String) to retrieve a android.view.LayoutInflater for inflating layout resources in this context.

Usage

From source file:com.andrewshu.android.reddit.mail.InboxListActivity.java

/**
 * Resets the output UI list contents, retains session state.
 * @param messagesAdapter A MessagesListAdapter to use. Pass in null if you want a new empty one created.
 *//*from   w w  w  .j  a v  a 2 s . c  om*/
void resetUI(MessagesListAdapter messagesAdapter) {
    findViewById(R.id.loading_light).setVisibility(View.GONE);
    findViewById(R.id.loading_dark).setVisibility(View.GONE);

    if (mSettings.isAlwaysShowNextPrevious()) {
        if (mNextPreviousView != null) {
            getListView().removeFooterView(mNextPreviousView);
            mNextPreviousView = null;
        }
    } else {
        findViewById(R.id.next_previous_layout).setVisibility(View.GONE);
        if (getListView().getFooterViewsCount() == 0) {
            // If we are not using the persistent navbar, then show as ListView footer instead
            LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            mNextPreviousView = inflater.inflate(R.layout.next_previous_list_item, null);
            getListView().addFooterView(mNextPreviousView);
        }
    }

    synchronized (MESSAGE_ADAPTER_LOCK) {
        if (messagesAdapter == null) {
            // Reset the list to be empty.
            mMessagesList = new ArrayList<ThingInfo>();
            mMessagesAdapter = new MessagesListAdapter(this, mMessagesList);
        } else {
            mMessagesAdapter = messagesAdapter;
        }
        setListAdapter(mMessagesAdapter);
        mMessagesAdapter.mIsLoading = false;
        mMessagesAdapter.notifyDataSetChanged(); // Just in case
    }
    getListView().setDivider(null);
    Common.updateListDrawables(this, mSettings.getTheme());
    updateNextPreviousButtons();
}

From source file:com.jiusg.mainscreenshow.ui.MSS.java

/**
 * ActionBar/* www  .j a va 2 s .c om*/
 *
 * @param layoutId Id
 */
public void setActionBarLayout(int layoutId) {
    ActionBar actionBar = getActionBar();
    if (null != actionBar) {
        actionBar.setDisplayShowHomeEnabled(false);
        actionBar.setDisplayShowCustomEnabled(true);
        actionBar.setDisplayShowTitleEnabled(false);
        actionBar.setDisplayHomeAsUpEnabled(false);
        actionBar.setDisplayUseLogoEnabled(false);

        LayoutInflater inflator = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View v = inflator.inflate(layoutId, null);
        ActionBar.LayoutParams layout = new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT);
        actionBar.setCustomView(v, layout);
    }
}

From source file:at.alladin.rmbt.android.adapter.result.RMBTResultPagerAdapter.java

public void addResultListItem(String title, String value, LinearLayout netLayout) {
    final float scale = activity.getResources().getDisplayMetrics().density;
    final int leftRightDiv = Helperfunctions.dpToPx(0, scale);
    final int topBottomDiv = Helperfunctions.dpToPx(0, scale);
    final int heightDiv = Helperfunctions.dpToPx(1, scale);

    LayoutInflater inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    final View measurementItemView = inflater.inflate(R.layout.classification_list_item, netLayout, false);

    final TextView itemTitle = (TextView) measurementItemView.findViewById(R.id.classification_item_title);
    itemTitle.setText(title);/*from w w  w .  ja  va 2  s .  c  o  m*/

    final ImageView itemClassification = (ImageView) measurementItemView
            .findViewById(R.id.classification_item_color);
    itemClassification.setImageResource(Helperfunctions.getClassificationColor(-1));

    itemClassification.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            activity.showHelp(R.string.url_help_result, false);
        }
    });

    final TextView itemValue = (TextView) measurementItemView.findViewById(R.id.classification_item_value);
    itemValue.setText(value);

    netLayout.addView(measurementItemView);

    final View divider = new View(activity);
    divider.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, heightDiv, 1));
    divider.setPadding(leftRightDiv, topBottomDiv, leftRightDiv, topBottomDiv);

    divider.setBackgroundResource(R.drawable.bg_trans_light_10);

    netLayout.addView(divider);

    netLayout.invalidate();
}

From source file:gc.david.dfm.ui.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Mint.initAndStartSession(MainActivity.this, "6f2149e6");
    // Enable logging
    Mint.enableLogging(true);//from w  w w . j a  va  2s .  co m
    Mint.leaveBreadcrumb("MainActivity::onCreate");

    setContentView(R.layout.activity_main);
    inject(this);

    DEVICE_DENSITY = getResources().getDisplayMetrics().density;

    googleApiClient = new GoogleApiClient.Builder(this).addApi(LocationServices.API)
            .addConnectionCallbacks(this).addOnConnectionFailedListener(this).build();

    final SupportMapFragment fragment = ((SupportMapFragment) getSupportFragmentManager()
            .findFragmentById(R.id.map));
    googleMap = fragment.getMap();

    if (googleMap != null) {
        googleMap.setMyLocationEnabled(true);
        googleMap.getUiSettings().setZoomControlsEnabled(true);
        googleMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);

        // InMobi Ads
        InMobi.initialize(this, "9b61f509a1454023b5295d8aea4482c2");
        banner = (IMBanner) findViewById(R.id.banner);
        if (banner != null) {
            // Si no hay red el banner no carga ni aunque est vaco
            banner.setRefreshInterval(30);
            banner.setIMBannerListener(new IMBannerListener() {
                @Override
                public void onShowBannerScreen(IMBanner arg0) {
                    Mint.leaveBreadcrumb("MainActivity::banner onShowBannerScreen");
                }

                @Override
                public void onLeaveApplication(IMBanner arg0) {
                    Mint.leaveBreadcrumb("MainActivity::banner onLeaveApplication");
                }

                @Override
                public void onDismissBannerScreen(IMBanner arg0) {
                    Mint.leaveBreadcrumb("MainActivity::banner onDismissBannerScreen");
                }

                @Override
                public void onBannerRequestSucceeded(IMBanner arg0) {
                    Mint.leaveBreadcrumb("MainActivity::banner onBannerRequestSucceeded");
                    bannerShown = true;
                    fixMapPadding();
                }

                @Override
                public void onBannerRequestFailed(IMBanner arg0, IMErrorCode arg1) {
                    Mint.leaveBreadcrumb("MainActivity::banner onBannerRequestFailed");
                }

                @Override
                public void onBannerInteraction(IMBanner arg0, Map<String, String> arg1) {
                    Mint.leaveBreadcrumb("MainActivity::banner onBannerInteraction");
                    Mint.logEvent("Ad tapped");
                }
            });
            banner.loadBanner();
        }

        if (!isOnline(getApplicationContext())) {
            showWifiAlertDialog();
        }

        googleMap.setOnMapLongClickListener(new OnMapLongClickListener() {
            @Override
            public void onMapLongClick(LatLng point) {
                Mint.leaveBreadcrumb("MainActivity::googleMap onMapLongClick");
                calculatingDistance = true;

                if (distanceMode == DistanceMode.DISTANCE_FROM_ANY_POINT) {
                    if (coordinates == null || coordinates.isEmpty()) {
                        toastIt(getString(R.string.toast_first_point_needed), getApplicationContext());
                    } else {
                        coordinates.add(point);
                        drawAndShowMultipleDistances(coordinates, "", false, true);
                    }
                }
                // Si no hemos encontrado la posicin actual, no podremos
                // calcular la distancia
                else if (currentLocation != null) {
                    if ((distanceMode == DistanceMode.DISTANCE_FROM_CURRENT_POINT) && (coordinates.isEmpty())) {
                        coordinates
                                .add(new LatLng(currentLocation.getLatitude(), currentLocation.getLongitude()));
                    }
                    coordinates.add(point);
                    drawAndShowMultipleDistances(coordinates, "", false, true);
                }

                calculatingDistance = false;
            }
        });

        googleMap.setOnMapClickListener(new GoogleMap.OnMapClickListener() {
            @Override
            public void onMapClick(LatLng point) {
                Mint.leaveBreadcrumb("MainActivity::googleMap onMapClick");
                if (distanceMode == DistanceMode.DISTANCE_FROM_ANY_POINT) {
                    if (!calculatingDistance) {
                        coordinates.clear();
                    }

                    calculatingDistance = true;

                    if (coordinates.isEmpty()) {
                        googleMap.clear();
                    }
                    coordinates.add(point);
                    googleMap.addMarker(new MarkerOptions().position(point));
                } else {
                    // Si no hemos encontrado la posicin actual, no podremos
                    // calcular la distancia
                    if (currentLocation != null) {
                        if (coordinates != null) {
                            if (!calculatingDistance) {
                                coordinates.clear();
                            }
                            calculatingDistance = true;

                            if (coordinates.isEmpty()) {
                                googleMap.clear();
                                coordinates.add(new LatLng(currentLocation.getLatitude(),
                                        currentLocation.getLongitude()));
                            }
                            coordinates.add(point);
                            googleMap.addMarker(new MarkerOptions().position(point));
                        } else {
                            final IllegalStateException illegalStateException = new IllegalStateException(
                                    "Empty coordinates list");
                            Mint.logException(illegalStateException);
                            throw illegalStateException;
                        }
                    }
                }
            }
        });

        // TODO Future release
        // Cambiar esto: debera modificar solamentela posicin que estemos tuneando y recalcular
        //         googleMap.setOnMarkerDragListener(new OnMarkerDragListener() {
        ////            private String selectedMarkerId;
        //
        //            @Override
        //            public void onMarkerDragStart(Marker marker) {
        ////               selectedMarkerId = null;
        ////               final String markerId = marker.getId();
        ////               if (coordinates.contains(markerId)) {
        ////                  for (int i = 0; i < coordinates.size(); i++) {
        ////                     final LatLng position = coordinates.get(i);
        ////                     if (markerId.latitude == position.latitude &&
        ////                           markerId.longitude == position.longitude) {
        ////                        selectedMarkerId = i;
        ////                        break;
        ////                     }
        ////                  }
        ////               }
        //            }
        //
        //            @Override
        //            public void onMarkerDragEnd(Marker marker) {
        ////               if (selectedMarkerId != -1) {
        ////                  coordinates.set(selectedMarkerId, marker.getPosition());
        ////               }
        ////               // NO movemos el zoom porque estamos simplemente afinando la
        ////               // posicin
        ////               drawAndShowMultipleDistances(coordinates, "", false, false);
        //            }
        //
        //            @Override
        //            public void onMarkerDrag(Marker marker) {
        //               // nothing
        //            }
        //         });

        googleMap.setOnInfoWindowClickListener(new OnInfoWindowClickListener() {
            @Override
            public void onInfoWindowClick(Marker marker) {
                Mint.leaveBreadcrumb("MainActivity::googleMap onInfoWindowClick");
                final Intent showInfoActivityIntent = new Intent(MainActivity.this, ShowInfoActivity.class);

                showInfoActivityIntent.putExtra(ShowInfoActivity.POSITIONS_LIST_EXTRA_KEY_NAME,
                        Lists.newArrayList(coordinates));
                showInfoActivityIntent.putExtra(ShowInfoActivity.DISTANCE_EXTRA_KEY_NAME,
                        distanceMeasuredAsText);
                startActivity(showInfoActivityIntent);
            }
        });

        googleMap.setInfoWindowAdapter(new MarkerInfoWindowAdapter(this));

        // Iniciando la app
        if (currentLocation == null) {
            toastIt(getString(R.string.toast_loading_position), getApplicationContext());
        }

        handleIntents(getIntent());

        final List<String> distanceModes = Lists.newArrayList(
                getString(R.string.navigation_drawer_starting_point_current_position_item),
                getString(R.string.navigation_drawer_starting_point_any_position_item));
        final List<Integer> distanceIcons = Lists.newArrayList(R.drawable.ic_action_device_gps_fixed,
                R.drawable.ic_action_communication_location_on);
        drawerList = (ListView) findViewById(R.id.left_drawer);

        // TODO cambiar esto por un header como dios manda
        final LayoutInflater inflater = (LayoutInflater) getApplicationContext()
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        final View convertView = inflater.inflate(R.layout.simple_textview_list_item, drawerList, false);
        final TextView tvListElement = (TextView) convertView.findViewById(R.id.simple_textview);
        tvListElement.setText(getString(R.string.navigation_drawer_starting_point_header));
        tvListElement.setClickable(false);
        tvListElement.setTextColor(getResources().getColor(R.color.white));
        drawerList.addHeaderView(convertView);
        drawerList.setAdapter(new NavigationDrawerItemAdapter(this, distanceModes, distanceIcons));

        drawerList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                selectItem(position);
            }
        });

        drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
        actionBarDrawerToggle = new ActionBarDrawerToggle(this, drawerLayout,
                R.string.progressdialog_search_position_message,
                R.string.progressdialog_search_position_message) {
            @Override
            public void onDrawerOpened(View drawerView) {
                Mint.leaveBreadcrumb("MainActivity::actionBarDrawerToggle onDrawerOpened");
                super.onDrawerOpened(drawerView);
                supportInvalidateOptionsMenu();
            }

            @Override
            public void onDrawerClosed(View drawerView) {
                Mint.leaveBreadcrumb("MainActivity::actionBarDrawerToggle onDrawerClosed");
                super.onDrawerClosed(drawerView);
                supportInvalidateOptionsMenu();
            }
        };

        drawerLayout.setDrawerListener(actionBarDrawerToggle);

        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setHomeButtonEnabled(true);

        if (savedInstanceState == null) {
            Mint.leaveBreadcrumb("MainActivity savedInstanceState == null");
            // TODO change this because the header!!!!
            selectItem(FIRST_DRAWER_ITEM_INDEX);
        }
    }
}

From source file:com.bvhloc.numpicker.widget.NumberPicker.java

/**
 * Set the orientation of the number picker.
 *
 * @param orientation {@link LinearLayout#VERTICAL} or {@link LinearLayout#HORIZONTAL}
 */// ww w .  j  a v  a 2s . co  m
@Override
public void setOrientation(int orientation) {
    if (getOrientation() != orientation) {
        super.removeAllViews();
        super.setOrientation(orientation);

        LayoutInflater inflater = (LayoutInflater) getContext()
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);

        if (orientation == VERTICAL) {
            inflater.inflate(R.layout.number_picker_vertical, this, true);
        } else if (orientation == HORIZONTAL) {
            inflater.inflate(R.layout.number_picker_horizontal, this, true);
        } else {
            throw new IllegalArgumentException("orientation has to be horizontal or vertical!");
        }
    }
}

From source file:com.esri.android.mapsapp.MapFragment.java

/**
 * Takes a MapView that has already been instantiated to show a WebMap,
 * completes its setup by setting various listeners and attributes, and sets
 * it as the activity's content view./*from w  w w .ja  va 2  s  .  c  o m*/
 * 
 * @param mapView
 */
private void setMapView(final MapView mapView) {

    mMapView = mapView;
    mMapView.setEsriLogoVisible(true);
    mMapView.enableWrapAround(true);
    mapView.setAllowRotationByPinch(true);

    // Creating an inflater
    mInflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    // Setting up the layout params for the searchview and searchresult
    // layout
    mlayoutParams = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT,
            Gravity.LEFT | Gravity.TOP);
    int LEFT_MARGIN_SEARCH = 15;
    int RIGHT_MARGIN_SEARCH = 15;
    int BOTTOM_MARGIN_SEARCH = 0;
    mlayoutParams.setMargins(LEFT_MARGIN_SEARCH, TOP_MARGIN_SEARCH, RIGHT_MARGIN_SEARCH, BOTTOM_MARGIN_SEARCH);

    // Add the map to the layout
    mMapContainer.addView(mMapView, 0);

    // Set up floating action button
    setClickListenerForFloatingActionButton();

    // Displaying the searchbox layout
    showSearchBoxLayout();

    mMapView.setOnPinchListener(new OnPinchListener() {

        /**
         * Default value
         */
        private static final long serialVersionUID = 1L;

        @Override
        public void postPointersDown(float x1, float y1, float x2, float y2, double factor) {
        }

        @Override
        public void postPointersMove(float x1, float y1, float x2, float y2, double factor) {
        }

        @Override
        public void postPointersUp(float x1, float y1, float x2, float y2, double factor) {
        }

        @Override
        public void prePointersDown(float x1, float y1, float x2, float y2, double factor) {
        }

        @Override
        public void prePointersMove(float x1, float y1, float x2, float y2, double factor) {
            if (mMapView.getRotationAngle() > 5 || mMapView.getRotationAngle() < -5) {
                mCompass.setVisibility(View.VISIBLE);
                mCompass.sensorManager.unregisterListener(mCompass.sensorEventListener);
                mCompass.setRotationAngle(mMapView.getRotationAngle());
            }
        }

        @Override
        public void prePointersUp(float x1, float y1, float x2, float y2, double factor) {
        }

    });

    // Setup listener for map initialized
    mMapView.setOnStatusChangedListener(new OnStatusChangedListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void onStatusChanged(Object source, STATUS status) {

            if (source == mMapView && status == STATUS.INITIALIZED) {

                mapSpatialReference = mMapView.getSpatialReference();

                if (mMapViewState == null) {
                    // Starting location tracking will cause zoom to My
                    // Location
                    startLocationTracking();
                } else {
                    mMapView.restoreState(mMapViewState);
                }
                // add search and routing layers
                addGraphicLayers();
            }
        }
    });

    // Setup use of magnifier on a long press on the map
    mMapView.setShowMagnifierOnLongPress(true);
    mLongPressEvent = null;

    // Setup OnTouchListener to detect and act on long-press
    mMapView.setOnTouchListener(new MapOnTouchListener(getActivity(), mMapView) {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
                // Start of a new gesture. Make sure mLongPressEvent is
                // cleared.
                mLongPressEvent = null;
            }
            return super.onTouch(v, event);
        }

        @Override
        public void onLongPress(MotionEvent point) {
            // Set mLongPressEvent to indicate we are processing a
            // long-press
            mLongPressEvent = point;
            super.onLongPress(point);

        }

        @Override
        public boolean onDragPointerUp(MotionEvent from, final MotionEvent to) {
            if (mLongPressEvent != null) {
                // This is the end of a long-press that will have displayed
                // the
                // magnifier.
                // Perform reverse-geocoding of the point that was pressed
                Point mapPoint = mMapView.toMapPoint(to.getX(), to.getY());
                ReverseGeocodingAsyncTask reverseGeocodeTask = new ReverseGeocodingAsyncTask();
                reverseGeocodeTask.execute(mapPoint);
                mPendingTask = reverseGeocodeTask;

                mLongPressEvent = null;
                // Remove any previous graphics
                resetGraphicsLayers();
            }
            return super.onDragPointerUp(from, to);
        }

    });

}

From source file:com.andrewshu.android.reddit.user.ProfileActivity.java

/**
 * Resets the output UI list contents, retains session state.
 * @param messagesAdapter A MessagesListAdapter to use. Pass in null if you want a new empty one created.
 *//*  www . ja va 2  s . co m*/
void resetUI(ThingsListAdapter messagesAdapter) {
    findViewById(R.id.loading_light).setVisibility(View.GONE);
    findViewById(R.id.loading_dark).setVisibility(View.GONE);

    if (mSettings.isAlwaysShowNextPrevious()) {
        if (mNextPreviousView != null) {
            getListView().removeFooterView(mNextPreviousView);
            mNextPreviousView = null;
        }
    } else {
        findViewById(R.id.next_previous_layout).setVisibility(View.GONE);
        if (getListView().getFooterViewsCount() == 0) {
            // If we are not using the persistent navbar, then show as ListView footer instead
            LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            mNextPreviousView = inflater.inflate(R.layout.next_previous_list_item, null);
            getListView().addFooterView(mNextPreviousView);
        }
    }

    synchronized (MESSAGE_ADAPTER_LOCK) {
        if (messagesAdapter == null) {
            // Reset the list to be empty.
            mThingsList = new ArrayList<ThingInfo>();
            mThingsAdapter = new ThingsListAdapter(this, mThingsList);
        } else {
            mThingsAdapter = messagesAdapter;
        }

        setListAdapter(mThingsAdapter);
        mThingsAdapter.mIsLoading = false;
        mThingsAdapter.notifyDataSetChanged(); // Just in case
    }
    getListView().setDivider(null);
    Common.updateListDrawables(this, mSettings.getTheme());
    updateNextPreviousButtons();
}

From source file:com.example.lowviscam.GalleryActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu items for use in the action bar
    MenuInflater inflater = getMenuInflater();
    if (isLight == true) {
        inflater.inflate(R.menu.gallery, menu);
    } else {//from  w w  w.java2  s . c o  m
        inflater.inflate(R.menu.gallery_dark, menu);
    }

    // Get the SearchView and set the searchable configuration
    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView();
    // Assumes current activity is the searchable activity
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
    searchView.setIconifiedByDefault(false); // Do not iconify the widget; expand it by default
    searchView.setSubmitButtonEnabled(true);
    searchView.setOnQueryTextListener(new OnQueryTextListener() {
        @Override
        public boolean onQueryTextSubmit(String query) {
            search(query);
            // First image toast
            String firstResult;
            if (numSearchResults == 0) {
                firstResult = "No results found for  " + query + ".";
            } else {
                firstResult = "The first image result is titled " + tagList[0];
            }

            SpannableString s = new SpannableString(firstResult);
            s.setSpan(new TypefaceSpan(GalleryActivity.this, "APHont-Regular_q15c.otf"), 0, s.length(),
                    Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
            Toast.makeText(GalleryActivity.this, s, Toast.LENGTH_LONG).show();
            return true;
        }

        @Override
        public boolean onQueryTextChange(String newText) {
            if (TextUtils.isEmpty(newText)) {
                search("");
            }

            return true;
        }

        public void search(String query) {
            // hide keyboard
            InputMethodManager inputManager = (InputMethodManager) GalleryActivity.this
                    .getSystemService(Context.INPUT_METHOD_SERVICE);
            inputManager.hideSoftInputFromWindow(GalleryActivity.this.getCurrentFocus().getWindowToken(),
                    InputMethodManager.HIDE_NOT_ALWAYS);

            // Fetch the {@link LayoutInflater} service so that new views can be created
            LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);

            // Find the {@link GridView} that was already defined in the XML layout
            GridView gridView = (GridView) findViewById(R.id.grid);
            try {
                gridView.setAdapter(new CouponAdapter(inflater, createSearchedCoupons(query)));
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

        }

    });

    return true;
    //return super.onCreateOptionsMenu(menu);
}

From source file:com.andrewshu.android.reddit.profile.ProfileActivity.java

/**
 * Resets the output UI list contents, retains session state.
 * @param messagesAdapter A MessagesListAdapter to use. Pass in null if you want a new empty one created.
 *//*from  ww  w .j  a va  2  s. c  o  m*/
void resetUI(ThingsListAdapter messagesAdapter) {
    setTheme(mSettings.getTheme());
    setContentView(R.layout.profile_list_content);
    registerForContextMenu(getListView());

    if (mSettings.isAlwaysShowNextPrevious()) {
        // Set mNextPreviousView to null; we can use findViewById(R.id.next_previous_layout).
        mNextPreviousView = null;
    } else {
        // If we are not using the persistent navbar, then show as ListView footer instead
        LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        mNextPreviousView = inflater.inflate(R.layout.next_previous_list_item, null);
        getListView().addFooterView(mNextPreviousView);
    }

    synchronized (MESSAGE_ADAPTER_LOCK) {
        if (messagesAdapter == null) {
            // Reset the list to be empty.
            mThingsList = new ArrayList<ThingInfo>();
            mThingsAdapter = new ThingsListAdapter(this, mThingsList);
        } else {
            mThingsAdapter = messagesAdapter;
        }

        setListAdapter(mThingsAdapter);
        mThingsAdapter.mIsLoading = false;
        mThingsAdapter.notifyDataSetChanged(); // Just in case
    }
    getListView().setDivider(null);
    Common.updateListDrawables(this, mSettings.getTheme());
    updateNextPreviousButtons();
}

From source file:com.andfchat.frontend.activities.ChatScreen.java

public void showDescription() {
    LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

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

    int height = (int) (this.height * 0.8f);
    int width = (int) (this.width * 0.8f);

    final PopupWindow descriptionPopup = new FListPopupWindow(layout, width, height);
    descriptionPopup.showAtLocation(chatFragment.getView(), Gravity.CENTER, 0, 0);

    final TextView descriptionText = (TextView) layout.findViewById(R.id.descriptionText);
    descriptionText.setText(SmileyReader.addSmileys(this, chatroomManager.getActiveChat().getDescription()));
    // Enable touching/clicking links in text
    descriptionText.setMovementMethod(LinkMovementMethod.getInstance());
}