本文整理汇总了Java中com.example.jingbin.cloudreader.app.CloudReaderApplication类的典型用法代码示例。如果您正苦于以下问题:Java CloudReaderApplication类的具体用法?Java CloudReaderApplication怎么用?Java CloudReaderApplication使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CloudReaderApplication类属于com.example.jingbin.cloudreader.app包,在下文中一共展示了CloudReaderApplication类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleCache
import com.example.jingbin.cloudreader.app.CloudReaderApplication; //导入依赖的package包/类
public void handleCache() {
ArrayList<FrontpageBean.ResultBeanXXXXXXXXXXXXXX.FocusBean.ResultBeanX> result = null;
try {
mBannerImages = (ArrayList<String>) ACache.get(CloudReaderApplication.getInstance()).getAsObject(Constants.BANNER_PIC);
result = (ArrayList<FrontpageBean.ResultBeanXXXXXXXXXXXXXX.FocusBean.ResultBeanX>) ACache.get(CloudReaderApplication.getInstance()).getAsObject(Constants.BANNER_PIC_DATA);
} catch (Exception ignored) {
}
if (mBannerImages != null && mBannerImages.size() > 0) {
// 加上缓存使其可以点击
everydayNavigator.showBannerView(mBannerImages, result);
} else {
showBanncerPage();
}
mLists = (ArrayList<List<AndroidBean>>) ACache.get(CloudReaderApplication.getInstance()).getAsObject(Constants.EVERYDAY_CONTENT);
if (mLists != null && mLists.size() > 0) {
everydayNavigator.showListView(mLists);
} else {
everydayNavigator.showRotaLoading();
showRecyclerViewData();
}
}
示例2: getVersionName
import com.example.jingbin.cloudreader.app.CloudReaderApplication; //导入依赖的package包/类
/**
* 获取当前应用的版本号
*/
public static String getVersionName() {
// 获取packagemanager的实例
PackageManager packageManager = CloudReaderApplication.getInstance().getPackageManager();
// getPackageName()是你当前类的包名,0代表是获取版本信息
PackageInfo packInfo = null;
try {
packInfo = packageManager.getPackageInfo(CloudReaderApplication.getInstance().getPackageName(), 0);
return packInfo.versionName;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
return "1.0";
}
}
示例3: showToast
import com.example.jingbin.cloudreader.app.CloudReaderApplication; //导入依赖的package包/类
public static void showToast(String text) {
if (mToast == null) {
mToast = Toast.makeText(CloudReaderApplication.getInstance(), text, Toast.LENGTH_SHORT);
}
mToast.setText(text);
mToast.show();
}
示例4: showBanncerPage
import com.example.jingbin.cloudreader.app.CloudReaderApplication; //导入依赖的package包/类
private void showBanncerPage() {
mEverydayModel.showBanncerPage(new RequestImpl() {
@Override
public void loadSuccess(Object object) {
if (mBannerImages == null) {
mBannerImages = new ArrayList<String>();
} else {
mBannerImages.clear();
}
FrontpageBean bean = (FrontpageBean) object;
if (bean != null && bean.getResult() != null && bean.getResult().getFocus() != null && bean.getResult().getFocus().getResult() != null) {
final ArrayList<FrontpageBean.ResultBeanXXXXXXXXXXXXXX.FocusBean.ResultBeanX> result = (ArrayList<FrontpageBean.ResultBeanXXXXXXXXXXXXXX.FocusBean.ResultBeanX>) bean.getResult().getFocus().getResult();
if (result != null && result.size() > 0) {
for (int i = 0; i < result.size(); i++) {
//获取所有图片
mBannerImages.add(result.get(i).getRandpic());
}
everydayNavigator.showBannerView(mBannerImages, result);
ACache.get(CloudReaderApplication.getInstance()).remove(Constants.BANNER_PIC);
ACache.get(CloudReaderApplication.getInstance()).put(Constants.BANNER_PIC, mBannerImages);
ACache.get(CloudReaderApplication.getInstance()).remove(Constants.BANNER_PIC_DATA);
ACache.get(CloudReaderApplication.getInstance()).put(Constants.BANNER_PIC_DATA, result);
}
}
}
@Override
public void loadFailed() {
}
@Override
public void addSubscription(Subscription subscription) {
activity.addSubscription(subscription);
}
});
}
示例5: BigAndroidViewModel
import com.example.jingbin.cloudreader.app.CloudReaderApplication; //导入依赖的package包/类
public BigAndroidViewModel(BaseFragment activity, String mType) {
this.activity = activity;
this.mType = mType;
mACache = ACache.get(CloudReaderApplication.getInstance());
mModel = new GankOtherModel();
}
示例6: showToast
import com.example.jingbin.cloudreader.app.CloudReaderApplication; //导入依赖的package包/类
@SuppressLint("ShowToast")
public static void showToast(String text) {
if (mToast == null) {
mToast = Toast.makeText(CloudReaderApplication.getInstance(), text, Toast.LENGTH_SHORT);
}
mToast.setText(text);
mToast.show();
}
示例7: getResoure
import com.example.jingbin.cloudreader.app.CloudReaderApplication; //导入依赖的package包/类
public static Resources getResoure() {
return CloudReaderApplication.getInstance().getResources();
}
示例8: dip2px
import com.example.jingbin.cloudreader.app.CloudReaderApplication; //导入依赖的package包/类
/**
* 根据手机的分辨率从 dp 的单位 转成为 px(像素)
*/
public static int dip2px(float dpValue) {
final float scale = CloudReaderApplication.getInstance().getResources().getDisplayMetrics().density;
return (int) (dpValue * scale + 0.5f);
}
示例9: px2dip
import com.example.jingbin.cloudreader.app.CloudReaderApplication; //导入依赖的package包/类
/**
* 根据手机的分辨率从 px(像素) 的单位 转成为 dp
*/
public static int px2dip(float pxValue) {
final float scale = CloudReaderApplication.getInstance().getResources().getDisplayMetrics().density;
return (int) (pxValue / scale + 0.5f);
}
示例10: copy
import com.example.jingbin.cloudreader.app.CloudReaderApplication; //导入依赖的package包/类
/**
* 实现文本复制功能
*
* @param content 复制的文本
*/
public static void copy(String content) {
// 得到剪贴板管理器
ClipboardManager cmb = (ClipboardManager) CloudReaderApplication.getInstance().getSystemService(Context.CLIPBOARD_SERVICE);
cmb.setText(content.trim());
}
示例11: WelfareViewModel
import com.example.jingbin.cloudreader.app.CloudReaderApplication; //导入依赖的package包/类
public WelfareViewModel(BaseFragment activity) {
this.activity = activity;
mModel = new GankOtherModel();
mACache = ACache.get(CloudReaderApplication.getInstance());
}
示例12: getSharedPreference
import com.example.jingbin.cloudreader.app.CloudReaderApplication; //导入依赖的package包/类
/**
* 获取SharedPreferences实例对象
*
* @param fileName
*/
private static SharedPreferences getSharedPreference(String fileName) {
return CloudReaderApplication.getInstance().getSharedPreferences(fileName, Context.MODE_PRIVATE);
}