本文整理汇总了Java中com.jecelyin.common.utils.L.e方法的典型用法代码示例。如果您正苦于以下问题:Java L.e方法的具体用法?Java L.e怎么用?Java L.e使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jecelyin.common.utils.L
的用法示例。
在下文中一共展示了L.e方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: delete
import com.jecelyin.common.utils.L; //导入方法依赖的package包/类
@Override
public void delete(final BoolResultListener listener) {
RootUtils.RootCommand command = new RootUtils.RootCommand("rm -rf \"%s\"", getAbsolutePath())
{
@Override
public void onFinish(boolean success, String output) {
listener.onResult(success && output.trim().isEmpty());
}
};
try {
RootTools.getShell(true).add(command);
}catch (Exception e) {
L.e(e);
listener.onResult(false);
}
}
示例2: setOAuth2Token
import com.jecelyin.common.utils.L; //导入方法依赖的package包/类
public GitHubClient setOAuth2Token(Context context) {
byte[] signature = SysUtils.getSignature(context);
if (signature == null)
return this;
int len = Math.min(32, signature.length);
byte[] bytes = new byte[len];
System.arraycopy(signature, 0, bytes, 0, len);
try {
// String u = EncryptionUtils.decryptText(bytes, Base64.decode(BuildConfig.GITHUB_USER, Base64.DEFAULT));
// String p = EncryptionUtils.decryptText(bytes, Base64.decode(BuildConfig.GITHUB_PWD, Base64.DEFAULT));
// setCredentials(u, p);
} catch (Exception e) {
L.e(e);
}
return this;
}
示例3: loadFilesPath
import com.jecelyin.common.utils.L; //导入方法依赖的package包/类
/**
* Helper method to set the files path. If an exception occurs, the files
* path will be null!
*
* @param context The context to use. Usually your Activity object.
*/
private static void loadFilesPath(Context context) {
if (context != null) {
try {
File file = context.getFilesDir();
// The file shouldn't be null, but apparently it still can happen, see
// http://code.google.com/p/android/issues/detail?id=8886
if (file != null) {
CrashConstants.FILES_PATH = file.getAbsolutePath();
}
} catch (Exception e) {
L.e("Exception thrown when accessing the files dir:");
e.printStackTrace();
}
}
}
示例4: loadPackageData
import com.jecelyin.common.utils.L; //导入方法依赖的package包/类
/**
* Helper method to set the package name and version code. If an exception
* occurs, these values will be null!
*
* @param context The context to use. Usually your Activity object.
*/
private static void loadPackageData(Context context) {
if (context != null) {
try {
PackageManager packageManager = context.getPackageManager();
PackageInfo packageInfo = packageManager.getPackageInfo(context.getPackageName(), 0);
CrashConstants.APP_PACKAGE = packageInfo.packageName;
CrashConstants.APP_VERSION = "" + packageInfo.versionCode;
CrashConstants.APP_VERSION_NAME = packageInfo.versionName;
int buildNumber = loadBuildNumber(context, packageManager);
if ((buildNumber != 0) && (buildNumber > packageInfo.versionCode)) {
CrashConstants.APP_VERSION = "" + buildNumber;
}
} catch (PackageManager.NameNotFoundException e) {
L.e("Exception thrown when accessing the package info:");
e.printStackTrace();
}
}
}
示例5: loadCrashIdentifier
import com.jecelyin.common.utils.L; //导入方法依赖的package包/类
/**
* Helper method to load the crash identifier.
*
* @param context the context to use. Usually your Activity object.
*/
private static void loadCrashIdentifier(Context context) {
String deviceIdentifier = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);
if (!TextUtils.isEmpty(CrashConstants.APP_PACKAGE) && !TextUtils.isEmpty(deviceIdentifier)) {
String combined = CrashConstants.APP_PACKAGE + ":" + deviceIdentifier + ":" + createSalt(context);
try {
MessageDigest digest = MessageDigest.getInstance("SHA-1");
byte[] bytes = combined.getBytes("UTF-8");
digest.update(bytes, 0, bytes.length);
bytes = digest.digest();
CrashConstants.CRASH_IDENTIFIER = bytesToHex(bytes);
} catch (Throwable e) {
L.e("Couldn't create CrashIdentifier with Exception:" + e.toString());
//TODO handle the exeption
}
}
}
示例6: detectEncoding
import com.jecelyin.common.utils.L; //导入方法依赖的package包/类
public static String detectEncoding(File file) {
// CharsetDetector detector = new CharsetDetector();
// try {
// detector.setText(new BufferedInputStream(new FileInputStream(file)));
// } catch (IOException e) {
// e.printStackTrace();
// }
// CharsetMatch detect = detector.detect();
// if(detect == null)
// return DEFAULT_ENCODING;
// String encoding = detect.getName();
String encoding = null;
try {
BufferedInputStream bufferedInputStream = new BufferedInputStream(new FileInputStream(file));
encoding = CharsetDetector.detect(bufferedInputStream);
bufferedInputStream.close();
} catch (Exception e) {
L.e(e);
}
if(TextUtils.isEmpty(encoding)) {
encoding = DEFAULT_ENCODING;
}
return encoding;
}
示例7: setOAuth2Token
import com.jecelyin.common.utils.L; //导入方法依赖的package包/类
public GitHubClient setOAuth2Token(Context context) {
byte[] signature = SysUtils.getSignature(context);
if (signature == null)
return this;
int len = Math.min(32, signature.length);
byte[] bytes = new byte[len];
System.arraycopy(signature, 0, bytes, 0, len);
try {
String u = EncryptionUtils.decryptText(bytes, Base64.decode(BuildConfig.GITHUB_USER, Base64.DEFAULT));
String p = EncryptionUtils.decryptText(bytes, Base64.decode(BuildConfig.GITHUB_PWD, Base64.DEFAULT));
setCredentials(u, p);
} catch (Exception e) {
L.e(e);
}
return this;
}
示例8: updateValue
import com.jecelyin.common.utils.L; //导入方法依赖的package包/类
private void updateValue(String key, Map<String, ?> values) {
Object value = map.get(key);
// 跳过一些不能通过本方法取值的东东
if (value == null)
return;
Class cls = value.getClass();
try {
if (cls == int.class || cls == Integer.class) {
// value = StringUtils.toInt(pm.getString(key, String.valueOf(value)));
Object in = values.get(key);
if (in != null)
value = in instanceof Integer ? (int) in : StringUtils.toInt(String.valueOf(in));
} else if (cls == boolean.class || cls == Boolean.class) {
// value = pm.getBoolean(key, (boolean)value);
Boolean b = (Boolean) values.get(key);
value = b == null ? (boolean) value : b;
} else {
// value = pm.getString(key, (String)value);
String str = (String) values.get(key);
value = str == null ? (String) value : str;
}
} catch (Exception e) {
L.e("key = " + key, e);
return;
}
map.put(key, value);
}
示例9: mkdirs
import com.jecelyin.common.utils.L; //导入方法依赖的package包/类
@Override
public void mkdirs(final BoolResultListener listener) {
try {
RootTools.getShell(true).add(new RootUtils.RootCommand("mkdir -p \"%s\"", getAbsolutePath()) {
@Override
public void onFinish(boolean success, String output) {
listener.onResult(success && output.trim().isEmpty());
}
});
} catch (Exception e) {
L.e(e);
}
}
示例10: renameTo
import com.jecelyin.common.utils.L; //导入方法依赖的package包/类
@Override
public void renameTo(JecFile dest, final BoolResultListener listener) {
try {
RootTools.getShell(true).add(new RootUtils.RootCommand("mv \"%s\" \"%s\"", getAbsolutePath(), dest.getAbsolutePath()) {
@Override
public void onFinish(boolean success, String output) {
listener.onResult(success && output.trim().isEmpty());
}
});
} catch (Exception e) {
L.e(e);
}
}
示例11: loadBuildNumber
import com.jecelyin.common.utils.L; //导入方法依赖的package包/类
/**
* Helper method to load the build number from the AndroidManifest.
*
* @param context the context to use. Usually your Activity object.
* @param packageManager an instance of PackageManager
*/
private static int loadBuildNumber(Context context, PackageManager packageManager) {
try {
ApplicationInfo appInfo = packageManager.getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA);
Bundle metaData = appInfo.metaData;
if (metaData != null) {
return metaData.getInt(BUNDLE_BUILD_NUMBER, 0);
}
} catch (PackageManager.NameNotFoundException e) {
L.e("Exception thrown when accessing the application info:");
e.printStackTrace();
}
return 0;
}
示例12: updateValue
import com.jecelyin.common.utils.L; //导入方法依赖的package包/类
private void updateValue(String key, Map<String, ?> values) {
Object value = map.get(key);
// 跳过一些不能通过本方法取值的东东
if(value == null)
return;
Class cls = value.getClass();
try {
if(cls == int.class || cls == Integer.class) {
// value = StringUtils.toInt(pm.getString(key, String.valueOf(value)));
Object in = values.get(key);
if (in != null)
value = in instanceof Integer ? (int)in : StringUtils.toInt(String.valueOf(in));
} else if(cls == boolean.class || cls == Boolean.class) {
// value = pm.getBoolean(key, (boolean)value);
Boolean b = (Boolean) values.get(key);
value = b == null ? (boolean)value : b;
} else {
// value = pm.getString(key, (String)value);
String str = (String) values.get(key);
value = str == null ? (String)value : str;
}
} catch (Exception e) {
L.e("key = " + key, e);
return;
}
map.put(key, value);
}
示例13: verifySign
import com.jecelyin.common.utils.L; //导入方法依赖的package包/类
public static boolean verifySign(Context context) {
try {
byte[] signature = SysUtils.getSignature(context);
if (signature == null)
return false;
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature);
final String currentSignature = Base64.encodeToString(md.digest(), Base64.DEFAULT);
return rightSign.equals(currentSignature);
} catch (Exception e) {
L.e(e);
return false;
}
}
示例14: readExcludeFrom
import com.jecelyin.common.utils.L; //导入方法依赖的package包/类
void readExcludeFrom(final String vals[]) {
for (String val : vals) {
try {
BufferedReader br = new BufferedReader(new FileReader(new File(val)));
for (String line = br.readLine(); line != null; line = br.readLine()) {
excludeFilePatterns.add(line);
}
} catch (IOException e) {
L.e(e);
}
}
}
示例15: processIntent
import com.jecelyin.common.utils.L; //导入方法依赖的package包/类
private void processIntent() {
try {
if (!processIntentImpl()) {
UIUtils.alert(getContext(), getString(R.string.cannt_handle_intent_x, getIntent().toString()));
}
} catch (Throwable e) {
L.e(e);
UIUtils.alert(getContext(), getString(R.string.handle_intent_x_error, getIntent().toString() + "\n" + e.getMessage()));
}
}