本文整理汇总了Java中com.androidquery.callback.BitmapAjaxCallback类的典型用法代码示例。如果您正苦于以下问题:Java BitmapAjaxCallback类的具体用法?Java BitmapAjaxCallback怎么用?Java BitmapAjaxCallback使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BitmapAjaxCallback类属于com.androidquery.callback包,在下文中一共展示了BitmapAjaxCallback类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: image
import com.androidquery.callback.BitmapAjaxCallback; //导入依赖的package包/类
protected T image(String url, boolean memCache, boolean fileCache, int targetWidth, int fallbackId, Bitmap preset, int animId, float ratio, int round, String networkUrl)
{
if (view instanceof ImageView)
{
BitmapAjaxCallback.async(act, getContext(), (ImageView) view, url, memCache, fileCache, targetWidth, fallbackId, preset, animId, ratio, AQuery.ANCHOR_DYNAMIC, progress, ah, policy, round, proxy, networkUrl);
reset();
}
return self();
}
示例2: getCachedImage
import com.androidquery.callback.BitmapAjaxCallback; //导入依赖的package包/类
/**
* Return bitmap cached by image requests. Returns null if url is not cached.
*
* @param url
* @param targetWidth The desired downsampled width.
* @return Bitmap
*/
public Bitmap getCachedImage(String url, int targetWidth)
{
Bitmap result = BitmapAjaxCallback.getMemoryCached(url, targetWidth);
if (result == null)
{
File file = getCachedFile(url);
if (file != null)
{
result = BitmapAjaxCallback.getResizedImage(file.getAbsolutePath(), null, targetWidth, true, 0);
}
}
return result;
}
示例3: shouldDelay
import com.androidquery.callback.BitmapAjaxCallback; //导入依赖的package包/类
public static boolean shouldDelay(int groupPosition, int childPosition, View convertView, ViewGroup parent, String url)
{
if (url == null || BitmapAjaxCallback.isMemoryCached(url))
{
return false;
}
AbsListView lv = (AbsListView) parent;
OnScrollListener sl = (OnScrollListener) parent.getTag(AQuery.TAG_SCROLL_LISTENER);
if (sl == null)
{
sl = new Common();
lv.setOnScrollListener(sl);
parent.setTag(AQuery.TAG_SCROLL_LISTENER, sl);
}
Integer scrollState = (Integer) lv.getTag(AQuery.TAG_NUM);
if (scrollState == null || scrollState == OnScrollListener.SCROLL_STATE_IDLE || scrollState == OnScrollListener.SCROLL_STATE_TOUCH_SCROLL)
{
return false;
}
long packed = childPosition;
if (parent instanceof ExpandableListView)
{
packed = ExpandableListView.getPackedPositionForChild(groupPosition, childPosition);
}
convertView.setTag(AQuery.TAG_NUM, packed);
//TODO add draw count and skip drawing list if possible
return true;
}
示例4: shouldDelayGallery
import com.androidquery.callback.BitmapAjaxCallback; //导入依赖的package包/类
private static boolean shouldDelayGallery(int position, View convertView, ViewGroup parent, String url)
{
if (url == null || BitmapAjaxCallback.isMemoryCached(url))
{
return false;
}
Gallery gallery = (Gallery) parent;
Integer selected = (Integer) gallery.getTag(AQuery.TAG_NUM);
if (selected == null)
{
selected = 0;
gallery.setTag(AQuery.TAG_NUM, 0);
gallery.setCallbackDuringFling(false);
Common common = new Common();
common.listen(gallery);
}
int first = gallery.getFirstVisiblePosition();
int last = gallery.getLastVisiblePosition();
int diff = last - first;
int delta = (diff / 2) + 1;
int from = selected - delta;
int to = selected + delta;
if (from < 0)
{
//shift window back to positive region
to = to - from;
from = 0;
}
if ((position >= from && position <= to))
{
//AQUtility.debug("yes", position + ":" + from + "." + to);
convertView.setTag(AQuery.TAG_NUM, position);
return false;
}
//AQUtility.debug("no", position + ":" + from + "." + to);
convertView.setTag(AQuery.TAG_NUM, null);
return true;
}
示例5: image
import com.androidquery.callback.BitmapAjaxCallback; //导入依赖的package包/类
protected T image(String url, boolean memCache, boolean fileCache, int targetWidth, int fallbackId, Bitmap preset, int animId, float ratio, int round, String networkUrl){
if(view instanceof ImageView){
BitmapAjaxCallback.async(act, getContext(), (ImageView) view, url, memCache, fileCache, targetWidth, fallbackId, preset, animId, ratio, AQuery.ANCHOR_DYNAMIC, progress, ah, policy, round, proxy, networkUrl);
reset();
}
return self();
}
示例6: getCachedImage
import com.androidquery.callback.BitmapAjaxCallback; //导入依赖的package包/类
/**
* Return bitmap cached by image requests. Returns null if url is not cached.
*
* @param url
* @param targetWidth The desired downsampled width.
*
* @return Bitmap
*/
public Bitmap getCachedImage(String url, int targetWidth){
Bitmap result = BitmapAjaxCallback.getMemoryCached(url, targetWidth);
if(result == null){
File file = getCachedFile(url);
if(file != null){
result = BitmapAjaxCallback.getResizedImage(file.getAbsolutePath(), null, targetWidth, true, 0);
}
}
return result;
}
示例7: shouldDelay
import com.androidquery.callback.BitmapAjaxCallback; //导入依赖的package包/类
public static boolean shouldDelay(int groupPosition, int childPosition, View convertView, ViewGroup parent, String url){
if(url == null || BitmapAjaxCallback.isMemoryCached(url)){
return false;
}
AbsListView lv = (AbsListView) parent;
OnScrollListener sl = (OnScrollListener) parent.getTag(AQuery.TAG_SCROLL_LISTENER);
if(sl == null){
sl = new Common();
lv.setOnScrollListener(sl);
parent.setTag(AQuery.TAG_SCROLL_LISTENER, sl);
}
Integer scrollState = (Integer) lv.getTag(AQuery.TAG_NUM);
if(scrollState == null || scrollState == OnScrollListener.SCROLL_STATE_IDLE || scrollState == OnScrollListener.SCROLL_STATE_TOUCH_SCROLL){
return false;
}
long packed = childPosition;
if(parent instanceof ExpandableListView){
packed = ExpandableListView.getPackedPositionForChild(groupPosition, childPosition);
}
convertView.setTag(AQuery.TAG_NUM, packed);
//TODO add draw count and skip drawing list if possible
return true;
}
示例8: onPostExecute
import com.androidquery.callback.BitmapAjaxCallback; //导入依赖的package包/类
@Override
protected void onPostExecute(String result) {
AQuery aQuery = new AQuery(mContext);
aQuery.id(mImageView);
aQuery.image(new File(result),true, mWidth, new BitmapAjaxCallback());
}
示例9: fillIcon
import com.androidquery.callback.BitmapAjaxCallback; //导入依赖的package包/类
public static void fillIcon(int imageIcon, AQuery aq, String filename, Context context) {
String hash = getIconHash(context, filename);
if (TextUtils.isEmpty(hash) || !hash.equals(aq.id(imageIcon).getTag())) {
BitmapAjaxCallback callback = new BitmapAjaxCallback();
File file = getBitmapFile(context, filename);
callback
// .animation(android.R.anim.slide_in_left)
.memCache(true).fallback(R.drawable.dummy_icon).file(file).url(filename);
aq.id(imageIcon).image(callback).tag(hash);
}
}
示例10: shouldDelay
import com.androidquery.callback.BitmapAjaxCallback; //导入依赖的package包/类
public static boolean shouldDelay(int groupPosition, int childPosition, View convertView, ViewGroup parent, String url){
if(url == null || BitmapAjaxCallback.isMemoryCached(url)){
return false;
}
AbsListView lv = (AbsListView) parent;
OnScrollListener sl = (OnScrollListener) parent.getTag(AQuery.TAG_SCROLL_LISTENER);
if(sl == null){
sl = new ExpandableGridScrollListener();
lv.setOnScrollListener(sl);
parent.setTag(AQuery.TAG_SCROLL_LISTENER, sl);
}
Integer scrollState = (Integer) lv.getTag(AQuery.TAG_NUM);
if(scrollState == null || scrollState == OnScrollListener.SCROLL_STATE_IDLE || scrollState == OnScrollListener.SCROLL_STATE_TOUCH_SCROLL){
return false;
}
/*long packed = childPosition;
if(parent instanceof ExpandableListView){
packed = ExpandableListView.getPackedPositionForChild(groupPosition, childPosition);
}
convertView.setTag(AQuery.TAG_NUM, packed);*/
//TODO add draw count and skip drawing list if possible
return true;
}
示例11: prepareImagesCache
import com.androidquery.callback.BitmapAjaxCallback; //导入依赖的package包/类
/**
* This method initializes cache with common image resources,
* so they can be used despite of the context the particular view is built within.
*/
private void prepareImagesCache() {
BitmapAjaxCallback.setCacheLimit(Integer.MAX_VALUE);
BitmapAjaxCallback.getMemoryCached(getBaseContext(), R.drawable.dummy_icon);
BitmapAjaxCallback.getMemoryCached(getBaseContext(), R.drawable.btn_check_off);
BitmapAjaxCallback.getMemoryCached(getBaseContext(), R.drawable.btn_check_off_disable);
BitmapAjaxCallback.getMemoryCached(getBaseContext(), R.drawable.btn_check_on);
BitmapAjaxCallback.getMemoryCached(getBaseContext(), R.drawable.btn_check_on_disable);
BitmapAjaxCallback.getMemoryCached(getBaseContext(), R.drawable.btn_check_on_selected);
}
示例12: getView
import com.androidquery.callback.BitmapAjaxCallback; //导入依赖的package包/类
@Override
public View getView(int position, View view, ViewGroup parent) {
ViewHolder holder;
if (view == null) {
LayoutInflater vi = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = vi.inflate(R.layout.list_item_book, null);
aq.recycle(view);
holder = new ViewHolder();
holder.author = aq.id(R.id.author).getTextView();
holder.title = aq.id(R.id.title).getTextView();
holder.imgCover = aq.id(R.id.imgCover).getImageView();
view.setTag(holder);
} else {
aq.recycle(view);
holder = (ViewHolder) view.getTag();
}
JSONObject book = getItem(position);
// Book cover
String bookId = book.optString("id");
String coverUrl = serverUrl + "/api/book/" + bookId + "/cover";
if (aq.shouldDelay(position, view, parent, coverUrl)) {
aq.id(holder.imgCover).image((Bitmap) null);
} else {
aq.id(holder.imgCover).image(new BitmapAjaxCallback()
.url(coverUrl)
.animation(AQuery.FADE_IN_NETWORK)
.cookie("auth_token", authToken)
);
}
// Filling book data
holder.author.setText(book.optString("author"));
holder.title.setText(book.optString("title"));
return view;
}
示例13: onLowMemory
import com.androidquery.callback.BitmapAjaxCallback; //导入依赖的package包/类
/**
* Called when the overall system is running low on memory
*/
@Override
public void onLowMemory() {
super.onLowMemory();
BitmapAjaxCallback.clearCache();
Log.w(TAG, "System is running low on memory");
}
示例14: onCreate
import com.androidquery.callback.BitmapAjaxCallback; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
// set the max size of the memory cache, default is 1M pixels (4MB)
BitmapAjaxCallback.setMaxPixelLimit(2000000);
setupAlarms();
}
示例15: onCreate
import com.androidquery.callback.BitmapAjaxCallback; //导入依赖的package包/类
@Override
public void onCreate() {
// https://github.com/androidquery/androidquery
if (getResources().getInteger(R.integer.development) == 1) {
AQUtility.setDebug(true);
}
AQUtility.cleanCacheAsync(this, 10000000, 5000000);
// set the max number of concurrent network connections, default is 4
AjaxCallback.setNetworkLimit(20);
// set the max number of icons (image width <= 50) to be cached in
// memory, default is 20
BitmapAjaxCallback.setIconCacheLimit(20);
// set the max number of images (image width > 50) to be cached in
// memory, default is 20
BitmapAjaxCallback.setCacheLimit(40);
// set the max size of an image to be cached in memory, default is 1600
// pixels (ie. 400x400)
BitmapAjaxCallback.setPixelLimit(600 * 600);
// set the max size of the memory cache, default is 1M pixels (4MB)
BitmapAjaxCallback.setMaxPixelLimit(4000000);
super.onCreate();
}