当前位置: 首页>>代码示例>>Java>>正文


Java AQUtility类代码示例

本文整理汇总了Java中com.androidquery.util.AQUtility的典型用法代码示例。如果您正苦于以下问题:Java AQUtility类的具体用法?Java AQUtility怎么用?Java AQUtility使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AQUtility类属于com.androidquery.util包,在下文中一共展示了AQUtility类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: margin

import com.androidquery.util.AQUtility; //导入依赖的package包/类
/**
 * Set the margin of a view. Notes all parameters are in DIP, not in pixel.
 *
 * @param leftDip   the left dip
 * @param topDip    the top dip
 * @param rightDip  the right dip
 * @param bottomDip the bottom dip
 * @return self
 */
public T margin(float leftDip, float topDip, float rightDip, float bottomDip)
{
	if (view != null)
	{
		LayoutParams lp = view.getLayoutParams();
		if (lp instanceof MarginLayoutParams)
		{
			Context context = getContext();
			int left = AQUtility.dip2pixel(context, leftDip);
			int top = AQUtility.dip2pixel(context, topDip);
			int right = AQUtility.dip2pixel(context, rightDip);
			int bottom = AQUtility.dip2pixel(context, bottomDip);
			((MarginLayoutParams) lp).setMargins(left, top, right, bottom);
			view.setLayoutParams(lp);
		}
	}
	return self();
}
 
开发者ID:libit,项目名称:lr_dialer,代码行数:28,代码来源:AbstractAQuery.java

示例2: size

import com.androidquery.util.AQUtility; //导入依赖的package包/类
private void size(boolean width, int n, boolean dip)
{
	if (view != null)
	{
		LayoutParams lp = view.getLayoutParams();
		Context context = getContext();
		if (n > 0 && dip)
		{
			n = AQUtility.dip2pixel(context, n);
		}
		if (width)
		{
			lp.width = n;
		}
		else
		{
			lp.height = n;
		}
		view.setLayoutParams(lp);
	}
}
 
开发者ID:libit,项目名称:lr_dialer,代码行数:22,代码来源:AbstractAQuery.java

示例3: permissionOk

import com.androidquery.util.AQUtility; //导入依赖的package包/类
private boolean permissionOk(String permissions, String old)
{
	if (permissions == null)
		return true;
	if (old == null)
		return false;
	String[] splits = old.split("[,\\s]+");
	Set<String> oldSet = new HashSet<String>(Arrays.asList(splits));
	splits = permissions.split("[,\\s]+");
	for (int i = 0; i < splits.length; i++)
	{
		if (!oldSet.contains(splits[i]))
		{
			AQUtility.debug("perm mismatch");
			return false;
		}
	}
	return true;
}
 
开发者ID:libit,项目名称:lr_dialer,代码行数:20,代码来源:FacebookHandle.java

示例4: webAuth

import com.androidquery.util.AQUtility; //导入依赖的package包/类
private void webAuth()
{
	AQUtility.debug("web auth");
	Bundle parameters = new Bundle();
	parameters.putString("client_id", appId);
	parameters.putString("type", "user_agent");
	if (permissions != null)
	{
		parameters.putString("scope", permissions);
	}
	parameters.putString("redirect_uri", REDIRECT_URI);
	String url = OAUTH_ENDPOINT + "?" + encodeUrl(parameters);
	FbWebViewClient client = new FbWebViewClient();
	dialog = new WebDialog(act, url, client);
	dialog.setLoadingMessage(message);
	dialog.setOnCancelListener(client);
	show();
	if (!first || token != null)
	{
		AQUtility.debug("auth hide");
		hide();
	}
	dialog.load();
	AQUtility.debug("auth started");
}
 
开发者ID:libit,项目名称:lr_dialer,代码行数:26,代码来源:FacebookHandle.java

示例5: expired

import com.androidquery.util.AQUtility; //导入依赖的package包/类
@Override
public boolean expired(AbstractAjaxCallback<?, ?> cb, AjaxStatus status)
{
	int code = status.getCode();
	if (code == 200)
		return false;
	String error = status.getError();
	if (error != null && error.contains("OAuthException"))
	{
		AQUtility.debug("fb token expired");
		return true;
	}
	String url = cb.getUrl();
	if (code == 400 && (url.endsWith("/likes") || url.endsWith("/comments") || url.endsWith("/checkins")))
	{
		return false;
	}
	if (code == 403 && (url.endsWith("/feed") || url.contains("method=delete")))
	{
		return false;
	}
	return code == 400 || code == 401 || code == 403;
}
 
开发者ID:libit,项目名称:lr_dialer,代码行数:24,代码来源:FacebookHandle.java

示例6: showUpdateDialog

import com.androidquery.util.AQUtility; //导入依赖的package包/类
protected void showUpdateDialog(JSONObject jo)
{
	if (jo == null || version != null)
		return;
	if (!isActive())
		return;
	JSONObject dia = jo.optJSONObject("dialog");
	String update = dia.optString("update", "Update");
	String skip = dia.optString("skip", "Skip");
	String rate = dia.optString("rate", "Rate");
	//String message = dia.optString("body", "");
	String body = dia.optString("wbody", "");
	String title = dia.optString("layout_title", "Update Available");
	AQUtility.debug("wbody", body);
	version = jo.optString("version", null);
	Drawable icon = getAppIcon();
	Context context = act;
	final AlertDialog dialog = new AlertDialog.Builder(context).setIcon(icon).setTitle(title).setPositiveButton(rate, handler).setNeutralButton(skip, handler).setNegativeButton(update, handler).create();
	dialog.setMessage(Html.fromHtml(patchBody(body), null, handler));
	aq.show(dialog);
	return;
}
 
开发者ID:libit,项目名称:lr_dialer,代码行数:23,代码来源:MarketService.java

示例7: stop

import com.androidquery.util.AQUtility; //导入依赖的package包/类
public void stop()
{
	AQUtility.debug("stop");
	Listener gListener = gpsListener;
	if (gListener != null)
	{
		lm.removeUpdates(gListener);
		gListener.cancel();
	}
	Listener nListener = networkListener;
	if (nListener != null)
	{
		lm.removeUpdates(nListener);
		nListener.cancel();
	}
	gpsListener = null;
	networkListener = null;
}
 
开发者ID:libit,项目名称:lr_dialer,代码行数:19,代码来源:LocationAjaxCallback.java

示例8: work

import com.androidquery.util.AQUtility; //导入依赖的package包/类
private void work()
{
	Location loc = getBestLocation();
	Timer timer = new Timer(false);
	if (networkEnabled)
	{
		AQUtility.debug("register net");
		networkListener = new Listener();
		lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, interval, 0, networkListener, Looper.getMainLooper());
		timer.schedule(networkListener, timeout);
	}
	if (gpsEnabled)
	{
		AQUtility.debug("register gps");
		gpsListener = new Listener();
		lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, interval, 0, gpsListener, Looper.getMainLooper());
		timer.schedule(gpsListener, timeout);
	}
	if (iteration > 1 && loc != null)
	{
		n++;
		callback(loc);
	}
	initTime = System.currentTimeMillis();
}
 
开发者ID:libit,项目名称:lr_dialer,代码行数:26,代码来源:LocationAjaxCallback.java

示例9: decode

import com.androidquery.util.AQUtility; //导入依赖的package包/类
private static Bitmap decode(String path, byte[] data, BitmapFactory.Options options, boolean rotate)
{
	Bitmap result = null;
	if (path != null)
	{
		result = decodeFile(path, options, rotate);
	}
	else if (data != null)
	{
		result = BitmapFactory.decodeByteArray(data, 0, data.length, options);
	}
	if (result == null && options != null && !options.inJustDecodeBounds)
	{
		AQUtility.debug("decode image failed", path);
	}
	return result;
}
 
开发者ID:libit,项目名称:lr_dialer,代码行数:18,代码来源:BitmapAjaxCallback.java

示例10: getClient

import com.androidquery.util.AQUtility; //导入依赖的package包/类
private static DefaultHttpClient getClient()
{
	if (client == null || !REUSE_CLIENT)
	{
		AQUtility.debug("creating http client");
		HttpParams httpParams = new BasicHttpParams();
		//httpParams.setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1);
		HttpConnectionParams.setConnectionTimeout(httpParams, NET_TIMEOUT);
		HttpConnectionParams.setSoTimeout(httpParams, NET_TIMEOUT);
		//ConnManagerParams.setMaxConnectionsPerRoute(httpParams, new ConnPerRouteBean(NETWORK_POOL));
		ConnManagerParams.setMaxConnectionsPerRoute(httpParams, new ConnPerRouteBean(25));
		//Added this line to avoid issue at: http://stackoverflow.com/questions/5358014/android-httpclient-oom-on-4g-lte-htc-thunderbolt
		HttpConnectionParams.setSocketBufferSize(httpParams, 8192);
		SchemeRegistry registry = new SchemeRegistry();
		registry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
		registry.register(new Scheme("https", ssf == null ? SSLSocketFactory.getSocketFactory() : ssf, 443));
		ThreadSafeClientConnManager cm = new ThreadSafeClientConnManager(httpParams, registry);
		client = new DefaultHttpClient(cm, httpParams);
	}
	return client;
}
 
开发者ID:libit,项目名称:lr_dialer,代码行数:22,代码来源:AbstractAjaxCallback.java

示例11: block

import com.androidquery.util.AQUtility; //导入依赖的package包/类
/**
 * Block the current thread until the ajax call is completed. Returns immediately if ajax is already completed.
 * Exception will be thrown if this method is called in main thread.
 */
public void block()
{
	if (AQUtility.isUIThread())
	{
		throw new IllegalStateException("Cannot block UI thread.");
	}
	if (completed)
		return;
	try
	{
		synchronized (this)
		{
			blocked = true;
			//wait at most the network timeout plus 5 seconds, this guarantee thread will never be blocked forever
			this.wait(NET_TIMEOUT + 5000);
		}
	}
	catch (Exception e)
	{
	}
}
 
开发者ID:libit,项目名称:lr_dialer,代码行数:26,代码来源:AbstractAjaxCallback.java

示例12: fileGet

import com.androidquery.util.AQUtility; //导入依赖的package包/类
protected T fileGet(String url, File file, AjaxStatus status)
{
	try
	{
		byte[] data = null;
		if (isStreamingContent())
		{
			status.file(file);
		}
		else
		{
			data = AQUtility.toBytes(new FileInputStream(file));
		}
		return transform(url, data, status);
	}
	catch (Exception e)
	{
		AQUtility.debug(e);
		return null;
	}
}
 
开发者ID:libit,项目名称:lr_dialer,代码行数:22,代码来源:AbstractAjaxCallback.java

示例13: showProgress

import com.androidquery.util.AQUtility; //导入依赖的package包/类
protected void showProgress(final boolean show)
{
	final Object p = progress == null ? null : progress.get();
	if (p != null)
	{
		if (AQUtility.isUIThread())
		{
			Common.showProgress(p, url, show);
		}
		else
		{
			AQUtility.post(new Runnable()
			{
				@Override
				public void run()
				{
					Common.showProgress(p, url, show);
				}
			});
		}
	}
}
 
开发者ID:libit,项目名称:lr_dialer,代码行数:23,代码来源:AbstractAjaxCallback.java

示例14: async

import com.androidquery.util.AQUtility; //导入依赖的package包/类
/**
 * Starts the async process.
 *
 * @param context the context
 */
public void async(Context context)
{
	if (status == null)
	{
		status = new AjaxStatus();
		status.redirect(url).refresh(refresh);
	}
	else if (status.getDone())
	{
		status.reset();
		result = null;
	}
	showProgress(true);
	if (ah != null)
	{
		if (!ah.authenticated())
		{
			AQUtility.debug("auth needed", url);
			ah.auth(this);
			return;
		}
	}
	work(context);
}
 
开发者ID:libit,项目名称:lr_dialer,代码行数:30,代码来源:AbstractAjaxCallback.java

示例15: failure

import com.androidquery.util.AQUtility; //导入依赖的package包/类
public void failure(int code, String message)
{
	if (status != null)
	{
		status.code(code).message(message).done();
		if (uiCallback)
		{
			AQUtility.post(this);
		}
		else
		{
			afterWork();
		}
		//callback();
	}
}
 
开发者ID:libit,项目名称:lr_dialer,代码行数:17,代码来源:AbstractAjaxCallback.java


注:本文中的com.androidquery.util.AQUtility类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。