本文整理汇总了Java中com.vk.sdk.VKSdk.DEBUG属性的典型用法代码示例。如果您正苦于以下问题:Java VKSdk.DEBUG属性的具体用法?Java VKSdk.DEBUG怎么用?Java VKSdk.DEBUG使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.vk.sdk.VKSdk
的用法示例。
在下文中一共展示了VKSdk.DEBUG属性的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: postExecution
@Override
protected boolean postExecution() {
if (!super.postExecution())
return false;
if (mParser != null) {
try {
JSONObject response = getResponseJson();
parsedModel = mParser.createModel(response);
return true;
} catch (Exception e) {
if (VKSdk.DEBUG) {
e.printStackTrace();
}
}
}
return false;
}
示例2: fill
/**
* Fills list according with data in {@code from}.
* @param from an array of items in the list. You can use null.
* @param creator interface implementation to parse objects.
*/
public void fill(JSONArray from, Parser<? extends T> creator) {
if(from != null) {
for(int i = 0; i < from.length(); i++) {
try {
T object = creator.parseObject(from.getJSONObject(i));
if(object != null) {
items.add(object);
}
} catch (Exception e) {
if (VKSdk.DEBUG)
e.printStackTrace();
}
}
}
}
示例3: getTmpFile
public File getTmpFile() {
Context ctx = VKUIHelper.getApplicationContext();
File outputDir = null;
if (ctx != null) {
outputDir = ctx.getExternalCacheDir();
if (outputDir == null || !outputDir.canWrite())
outputDir = ctx.getCacheDir();
}
File tmpFile = null;
try {
tmpFile = File.createTempFile("tmpImg", String.format(".%s", mParameters.fileExtension()), outputDir);
FileOutputStream fos = new FileOutputStream(tmpFile);
if (mParameters.mImageType == VKImageParameters.VKImageType.Png)
mImageData.compress(Bitmap.CompressFormat.PNG, 100, fos);
else
mImageData.compress(Bitmap.CompressFormat.JPEG, (int) (mParameters.mJpegQuality * 100), fos);
fos.close();
} catch (IOException ignored) {
if (VKSdk.DEBUG)
ignored.printStackTrace();
}
return tmpFile;
}
示例4: md5
/**
* Returns md5 hash of string
*
* @param s string to hash
* @return md5 hash
*/
public static String md5(final String s) {
try {
// Create MD5 Hash
MessageDigest digest = MessageDigest.getInstance("MD5");
digest.update(s.getBytes());
byte messageDigest[] = digest.digest();
// Create Hex String
StringBuilder hexString = new StringBuilder();
for (byte aMessageDigest : messageDigest) {
String h = Integer.toHexString(0xFF & aMessageDigest);
while (h.length() < 2)
h = "0" + h;
hexString.append(h);
}
return hexString.toString();
} catch (NoSuchAlgorithmException e) {
if (VKSdk.DEBUG)
e.printStackTrace();
}
return "";
}
示例5: mapFrom
/**
* Builds map from list of strings
*
* @param args key-value pairs for build a map. Must be a multiple of 2
* @return Result map. If args not multiple of 2, last argument will be ignored
*/
public static Map<String, Object> mapFrom(Object... args) {
if (args.length % 2 != 0) {
if (VKSdk.DEBUG)
Log.w("VKUtil", "Params must be paired. Last one is ignored");
}
LinkedHashMap<String, Object> result = new LinkedHashMap<>(args.length / 2);
for (int i = 0; i + 1 < args.length; i += 2) {
if (args[i] == null || args[i + 1] == null || !(args[i] instanceof String)) {
if (VKSdk.DEBUG)
Log.e("VK SDK", "Error while using mapFrom", new InvalidParameterSpecException("Key and value must be specified. Key must be string"));
continue;
}
result.put((String) args[i], args[i + 1]);
}
return result;
}
示例6: parse
@Override
public VKApiModel parse(JSONObject object) {
try {
JSONArray jsonArray;
if ((jsonArray = object.optJSONArray("response")) == null)
{
object = object.getJSONObject("response");
count = object.getInt("count");
jsonArray = object.getJSONArray("items");
}
parse(jsonArray);
} catch (JSONException e) {
if (VKSdk.DEBUG)
e.printStackTrace();
}
fields = object;
return this;
}
示例7: getTmpFile
public File getTmpFile() {
Context ctx = VKUIHelper.getTopActivity();
File outputDir = null;
if (ctx != null) {
outputDir = ctx.getExternalCacheDir();
if (outputDir == null)
outputDir = ctx.getCacheDir();
}
File tmpFile = null;
try {
tmpFile = File.createTempFile("tmpImg", String.format(".%s", mParameters.fileExtension()), outputDir);
FileOutputStream fos = new FileOutputStream(tmpFile);
if (mParameters.mImageType == VKImageParameters.VKImageType.Png)
mImageData.compress(Bitmap.CompressFormat.PNG, 100, fos);
else
mImageData.compress(Bitmap.CompressFormat.JPEG, (int) (mParameters.mJpegQuality * 100), fos);
fos.close();
} catch (IOException ignored) {
if (VKSdk.DEBUG)
ignored.printStackTrace();
}
return tmpFile;
}
示例8: postExecution
@Override
protected boolean postExecution() {
if (!super.postExecution())
return false;
if (mParser != null) {
try {
JSONObject response = getResponseJson();
parsedModel = mParser.createModel(response);
return true;
} catch (Exception e) {
if (VKSdk.DEBUG)
e.printStackTrace();
}
}
return false;
}
示例9: VKHTTPRequest
public VKHTTPRequest(@Nullable String url) {
if (url != null) {
try {
this.methodUrl = new URL(url);
} catch (MalformedURLException e) {
if (VKSdk.DEBUG) {
e.printStackTrace();
}
}
}
}
示例10: createModel
@Override
public Object createModel(JSONObject object) {
try {
VKApiModel model = mModelClass.newInstance();
model.parse(object);
return model;
} catch (Exception e) {
if (VKSdk.DEBUG)
e.printStackTrace();
}
return null;
}
示例11: call
@Override
public FREObject call( FREContext context, FREObject[] args ) {
super.call( context, args );
boolean enableLogs = FREObjectUtils.getBoolean( args[1] );
AIR.setLogEnabled( enableLogs );
VKSdk.DEBUG = enableLogs;
int appId = Integer.valueOf( FREObjectUtils.getString( args[0] ) );
AIR.log( "Initializing VKSdk" );
Activity activity = AIR.getContext().getActivity();
AIR.startAccessTokenTracker();
VKSdk.customInitialize( activity, appId, "" );
VKSdk.wakeUpSession( activity, new VKCallback<VKSdk.LoginState>() {
@Override
public void onResult( VKSdk.LoginState res ) {
AIR.log( "VKSdk.wakeUpSession::onResult " + res );
AIR.notifyTokenChange( VKAccessToken.currentToken() );
}
@Override
public void onError( VKError error ) {
AIR.log( "VKSdk.wakeUpSession::onError " + error.errorReason );
AIR.notifyTokenChange( VKAccessToken.currentToken() );
}
} );
return null;
}
示例12: log
private static void log(String s) {
if (VKSdk.DEBUG) {
if (!TextUtils.isEmpty(s)) {
Log.e("vk", s);
}
}
}