List of usage examples for android.content.res Resources getInteger
public int getInteger(@IntegerRes int id) throws NotFoundException
From source file:com.silentcircle.contacts.list.ContactTileListFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); Resources res = getResources(); int columnCount = res.getInteger(R.integer.contact_tile_column_count_in_favorites); mAdapter = new ContactTileAdapter(activity, mAdapterListener, columnCount, mDisplayType); mAdapter.setPhotoLoader(ContactPhotoManager.getInstance(activity)); }
From source file:com.amazingmvp.ui.activity.HomeActivity.java
/** * This method will only be executed if the device * is a tablet(sw bigger than 600dp)./*from w w w . j av a 2 s. c o m*/ */ private void toggleTabletMode() { Resources res = getResources(); if (res.getBoolean(R.bool.tablet)) { int spacing = ViewUtil.getWidth(this) / res.getInteger(R.integer.view_pager_spacing); viewPager.setClipToPadding(false); viewPager.setPadding(spacing, 0, spacing, 0); viewPager.setPageMargin(spacing / 6); } }
From source file:bangla.music.com.musicbanglatv.YouTubeRecyclerViewFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // set the Picasso debug indicator only for debug builds Picasso.with(getActivity()).setIndicatorsEnabled(BuildConfig.DEBUG); // Inflate the layout for this fragment View rootView = inflater.inflate(R.layout.youtube_recycler_view_fragment, container, false); mRecyclerView = (RecyclerView) rootView.findViewById(R.id.youtube_recycler_view); // use this setting to improve performance if you know that changes // in content do not change the layout size of the RecyclerView mRecyclerView.setHasFixedSize(true); Resources resources = getResources(); if (resources.getBoolean(R.bool.isTablet)) { // use a staggered grid layout if we're on a large screen device mLayoutManager = new StaggeredGridLayoutManager(resources.getInteger(R.integer.columns), StaggeredGridLayoutManager.VERTICAL); } else {//www.ja va 2s . c om // use a linear layout on phone devices mLayoutManager = new LinearLayoutManager(getActivity()); } mRecyclerView.setLayoutManager(mLayoutManager); return rootView; }
From source file:com.ramsofttech.adpushlibrary.fragment.GridFragment.java
/** * onCreate//from w w w .j a va 2 s . co m */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Read the arguments and check resource values for number of rows and number of columns // so we know how many images to display on this fragment. Bundle args = getArguments(); mNum = ((args != null) ? args.getInt("num") : 0); if (args != null) { mFirstImage = args.getInt("firstImage"); } // mImageCount = ((args != null) ? args.getInt ("imageCount") : -1); // Recalculate image count and then set mFirstImage to the first page that // includes the old first image. We recalculate the image count because it might change // if we are reorienting from portrait to landscape. Resources res = getActivity().getResources(); int numRows = res.getInteger(R.integer.grid_num_rows); int numCols = res.getInteger(R.integer.grid_num_cols); AppDataHolder dataHolder = ((AppDataHolder) getActivity().getApplicationContext()); if (dataHolder.getNumCols() != 0) numCols = dataHolder.getNumCols(); if (dataHolder.getNumRows() != 0) numRows = dataHolder.getNumRows(); int numTopicsPerPage = numRows * numCols; mImageCount = numTopicsPerPage; mFirstImage = (mFirstImage / numTopicsPerPage) * numTopicsPerPage; // What happens as you re-orient? Might need to do better here. }
From source file:develop.d2ru.kpop.fragments.YouTubeRecyclerViewFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // set the Picasso debug indicator only for debug builds // Inflate the layout for this fragment View rootView = inflater.inflate(R.layout.youtube_recycler_view_fragment, container, false); mRecyclerView = (RecyclerView) rootView.findViewById(R.id.youtube_recycler_view); // use this setting to improve performance if you know that changes // in content do not change the layout size of the RecyclerView mRecyclerView.setHasFixedSize(true); Resources resources = getResources(); if (resources.getBoolean(R.bool.isTablet)) { // use a staggered grid layout if we're on a large screen device mLayoutManager = new StaggeredGridLayoutManager(resources.getInteger(R.integer.columns), StaggeredGridLayoutManager.VERTICAL); } else {//from w ww . ja va 2s. c o m // use a linear layout on phone devices mLayoutManager = new LinearLayoutManager(getActivity()); } mRecyclerView.setLayoutManager(mLayoutManager); return rootView; }
From source file:de.avpptr.umweltzone.map.MapFragment.java
private void drawPolygonOverlay() { Activity activity = getActivity();/*w ww .j a v a 2 s . co m*/ String cityName = mPreferencesHelper.restoreLastKnownLocationAsString(); if (cityName == null || cityName.length() < 1) { return; } @SuppressWarnings("unchecked") List<Circuit> circuits = ContentProvider.getCircuits(activity, cityName); Resources resources = getResources(); int fillColor = resources.getColor(R.color.shape_fill_color); int strokeColor = resources.getColor(R.color.shape_stroke_color); int strokeWidth = resources.getInteger(R.integer.shape_stroke_width); mMapDrawer.drawPolygons(circuits, fillColor, strokeColor, strokeWidth); }
From source file:com.silentcircle.contacts.group.GroupDetailFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); mContext = activity;/*w ww . j av a 2s . c o m*/ mAccountTypeManager = AccountTypeManager.getInstance(mContext); Resources res = getResources(); int columnCount = res.getInteger(R.integer.contact_tile_column_count); mAdapter = new ContactTileAdapter(activity, mContactTileListener, columnCount, ContactTileAdapter.DisplayType.GROUP_MEMBERS); configurePhotoLoader(); }
From source file:com.etime.LoginAsyncTask.java
@Override protected void onPreExecute() { Resources res = activity.getResources(); myProgress = 0;//from w ww . java 2 s.c om LOGIN_URL = activity.getString(R.string.login_url); LOGIN_URL_STEP2 = activity.getString(R.string.login_url2); LOGIN_FAILED = activity.getString(R.string.login_failed_str); LOGIN_URL_PAGE_SIZE = res.getInteger(R.integer.size_of_login_url); LOGIN_URL2_PAGE_SIZE = res.getInteger(R.integer.size_of_login_url2_noredirect); }
From source file:com.akoscz.youtube.YouTubeRecyclerViewFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // set the Picasso debug indicator only for debug builds Picasso.with(getActivity()).setIndicatorsEnabled(BuildConfig.DEBUG); // Inflate the layout for this fragment View rootView = inflater.inflate(R.layout.youtube_recycler_view_fragment, container, false); mRecyclerView = (RecyclerView) rootView.findViewById(R.id.youtube_recycler_view); // use this setting to improve performance if you know that changes // in content do not change the layout size of the RecyclerView mRecyclerView.setHasFixedSize(true); Resources resources = getResources(); if (resources.getBoolean(R.bool.isTablet)) { // use a staggered grid layout if we're on a large screen device mLayoutManager = new StaggeredGridLayoutManager(resources.getInteger(R.integer.columns), StaggeredGridLayoutManager.VERTICAL); } else {//from w w w .ja v a 2 s . c o m // use a linear layout on phone devices mLayoutManager = new LinearLayoutManager(getActivity()); } mRecyclerView.setLayoutManager(mLayoutManager); mPlaylistSpinner = (Spinner) rootView.findViewById(R.id.youtube_playlist_spinner); return rootView; }
From source file:pl.itiner.nutiteq.NutiteqMap.java
private void createMapComponent() { final Resources res = getResources(); final int initialZoom = res.getInteger(R.integer.initial_zoom); final String mapKey = res.getString(R.string.nutiteq_key); final WgsPoint center = new WgsPoint(Double.parseDouble(res.getString(R.string.poznan_centre_lon)), Double.parseDouble(res.getString(R.string.poznan_centre_lat))); final BalloonLabel userLocationLabel = new BalloonLabel(res.getString(R.string.your_location), ""); mapComponent = new BasicMapComponent(mapKey, new AppContext(this), 1, 1, center, initialZoom); final MemoryCache memoryCache = new MemoryCache(MEM_CACHE_SIZE); final File cacheDir = getCacheDir(); if (!cacheDir.exists()) { cacheDir.mkdir();//from w ww. ja va 2 s .com } final FileCache fileSystemCache = new FileCache(this, "network_cache", cacheDir, FILE_CACHE_SIZE); mapComponent.setNetworkCache(new CachingChain(new Cache[] { memoryCache, fileSystemCache })); map = getMap(); mapComponent.setMap(map); mapComponent.setSmoothZoom(true); mapComponent.setPanningStrategy(new ThreadDrivenPanning()); mapComponent.startMapping(); userPlace = new Place(0, userLocationLabel, gps, userLocation); mapComponent.setOnMapElementListener(elemListener); }