use of com.bumptech.glide.samples.flickr.api.Query in project glide by bumptech.
the class FlickrSearchActivity method onCreate.
/**
* Called when the activity is first created.
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectAll().penaltyLog().build());
backgroundThread = new HandlerThread("BackgroundThumbnailHandlerThread");
backgroundThread.start();
backgroundHandler = new Handler(backgroundThread.getLooper());
setContentView(R.layout.flickr_search_activity);
searching = findViewById(R.id.searching);
searchLoading = findViewById(R.id.search_loading);
searchTerm = (TextView) findViewById(R.id.search_term);
Resources res = getResources();
ViewPager pager = (ViewPager) findViewById(R.id.view_pager);
pager.setPageMargin(res.getDimensionPixelOffset(R.dimen.page_margin));
pager.setAdapter(new FlickrPagerAdapter(getSupportFragmentManager()));
Api.get(this).registerSearchListener(queryListener);
if (savedInstanceState != null) {
Query savedQuery = savedInstanceState.getParcelable(STATE_QUERY);
if (savedQuery != null) {
executeQuery(savedQuery);
}
} else {
executeQuery(RecentQuery.get());
}
int smallGridSize = res.getDimensionPixelSize(R.dimen.small_photo_side);
int mediumGridSize = res.getDimensionPixelSize(R.dimen.medium_photo_side);
int listHeightSize = res.getDimensionPixelSize(R.dimen.flickr_list_item_height);
int screenWidth = getScreenWidth();
if (savedInstanceState == null) {
// Weight values determined experimentally by measuring the number of incurred GCs while
// scrolling through the various photo grids/lists.
Glide.get(this).preFillBitmapPool(new PreFillType.Builder(smallGridSize).setWeight(1), new PreFillType.Builder(mediumGridSize).setWeight(1), new PreFillType.Builder(screenWidth / 2, listHeightSize).setWeight(6));
}
}
use of com.bumptech.glide.samples.flickr.api.Query in project glide by bumptech.
the class FlickrSearchActivity method executeSearch.
private void executeSearch(String searchString) {
Query query = TextUtils.isEmpty(searchString) ? null : new SearchQuery(searchString);
executeQuery(query);
}
Aggregations