本文整理汇总了Java中com.jess.arms.base.BaseApplication类的典型用法代码示例。如果您正苦于以下问题:Java BaseApplication类的具体用法?Java BaseApplication怎么用?Java BaseApplication使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BaseApplication类属于com.jess.arms.base包,在下文中一共展示了BaseApplication类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: saveCookie
import com.jess.arms.base.BaseApplication; //导入依赖的package包/类
private void saveCookie(String url,String domain,String cookies) {
//Log.e("RequestIntercept", "url:" + url + "");
//Log.e("RequestIntercept", "domain:" + domain + "");
//Log.e("RequestIntercept", "cookies:" + cookies + "");
SharedPreferences sp = BaseApplication.getContext().getSharedPreferences(COOKIE_PREF, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sp.edit();
/*
if (url.isEmpty()) {
throw new NullPointerException("url is null.");
}else{
editor.putString(url, cookies);
}
*/
if (!domain.isEmpty()) {
editor.putString(domain, cookies);
}
editor.apply();
}
开发者ID:Zyj163,项目名称:yyox,代码行数:24,代码来源:RequestIntercept.java
示例2: getCookie
import com.jess.arms.base.BaseApplication; //导入依赖的package包/类
private String getCookie(String url, String domain) {
SharedPreferences sp = BaseApplication.getContext().getSharedPreferences(COOKIE_PREF, Context.MODE_PRIVATE);
//Map<String, ?> allContent = sp.getAll();
//注意遍历map的方法
//for(Map.Entry<String, ?> entry : allContent.entrySet()){
// Log.e("RequestIntercept", "getCookie:-------------------------------------------------" + (entry.getKey()+entry.getValue()) + "");
//}
if (!url.isEmpty()&&sp.contains(url)&&!sp.getString(url,"").isEmpty()) {
return sp.getString(url, "");
}
if (!domain.isEmpty()&&sp.contains(domain) && !sp.getString(domain, "").isEmpty()) {
return sp.getString(domain, "");
}
return null;
}
开发者ID:Zyj163,项目名称:yyox,代码行数:19,代码来源:RequestIntercept.java
示例3: initToast
import com.jess.arms.base.BaseApplication; //导入依赖的package包/类
private static Toast initToast(CharSequence message, int duration) {
if (toast == null) {
toast = Toast.makeText(BaseApplication.getContext(), message, duration);
} else {
toast.setText(message);
toast.setDuration(duration);
}
return toast;
}
开发者ID:snowwolf10285,项目名称:PicShow-zhaipin,代码行数:10,代码来源:ToastUtil.java
示例4: getResources
import com.jess.arms.base.BaseApplication; //导入依赖的package包/类
/**
* 获得资源
*/
public static Resources getResources() {
return BaseApplication.getContext().getResources();
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:7,代码来源:UiUtils.java
示例5: dip2px
import com.jess.arms.base.BaseApplication; //导入依赖的package包/类
/**
* dip转pix
*
* @param dpValue
* @return
*/
public static int dip2px(float dpValue) {
final float scale = BaseApplication.getContext().getResources().getDisplayMetrics().density;
return (int) (dpValue * scale + 0.5f);
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:11,代码来源:UiUtils.java
示例6: getContext
import com.jess.arms.base.BaseApplication; //导入依赖的package包/类
/**
* 获得上下文
*
* @return
*/
public static Context getContext() {
return BaseApplication.getContext();
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:UiUtils.java
示例7: showShort
import com.jess.arms.base.BaseApplication; //导入依赖的package包/类
/**
* 短时间显示Toast
*
* @param strResId
*/
public static void showShort(int strResId) {
// Toast.makeText(context, strResId, Toast.LENGTH_SHORT).show();
initToast(BaseApplication.getContext().getResources().getText(strResId), Toast.LENGTH_SHORT).show();
}
开发者ID:snowwolf10285,项目名称:PicShow-zhaipin,代码行数:10,代码来源:ToastUtil.java
示例8: showLong
import com.jess.arms.base.BaseApplication; //导入依赖的package包/类
/**
* 长时间显示Toast
*
* @param strResId
*/
public static void showLong(int strResId) {
initToast(BaseApplication.getContext().getResources().getText(strResId), Toast.LENGTH_LONG).show();
}
开发者ID:snowwolf10285,项目名称:PicShow-zhaipin,代码行数:9,代码来源:ToastUtil.java
示例9: inject
import com.jess.arms.base.BaseApplication; //导入依赖的package包/类
void inject(BaseApplication application);
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:2,代码来源:BaseComponent.java
注:本文中的com.jess.arms.base.BaseApplication类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论