• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java FinalDb类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: provideDaoConfig

import net.tsz.afinal.FinalDb; //导入依赖的package包/类
@Provides @Singleton FinalDb.DaoConfig provideDaoConfig(
        @ContextLifeCycle("App") Context context) {
    FinalDb.DaoConfig config = new FinalDb.DaoConfig();
    config.setDbName("ignore.db");
    //config.setDbVersion(2);
    config.setDebug(BuildConfig.DEBUG);
    config.setContext(context);
    //config.setDbUpdateListener((db, oldVersion, newVersion) -> {
    //    //if (newVersion == 2 && oldVersion == 1) {
    //    //    db.execSQL("ALTER TABLE '" + "ignore" + "' ADD COLUMN " +
    //    //            "appName" + " TEXT;");
    //    //    db.execSQL("ALTER TABLE '" + "ignore" + "' ADD COLUMN " +
    //    //            "appIcon" + " BLOB;");
    //    //}
    //});
    return config;
}
 
开发者ID:towavephone,项目名称:MemoryCleaner,代码行数:18,代码来源:AppModule.java


示例2: IgnoreSettingPresenter

import net.tsz.afinal.FinalDb; //导入依赖的package包/类
@Inject
public IgnoreSettingPresenter(@ContextLifeCycle("Activity")
                              Context context, FinalDb finalDb, ObservableUtils observableUtils) {
    this.mContext = context;
    this.mFinalDb = finalDb;
    this.mObservableUtils = observableUtils;
}
 
开发者ID:towavephone,项目名称:MemoryCleaner,代码行数:8,代码来源:IgnoreSettingPresenter.java


示例3: setUp

import net.tsz.afinal.FinalDb; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    Context context = getContext();

    finalDb = FinalDb.create(context, false);
}
 
开发者ID:kkmike999,项目名称:YuiHatano,代码行数:7,代码来源:AfinalTest.java


示例4: OneToManyLazyLoader

import net.tsz.afinal.FinalDb; //导入依赖的package包/类
public OneToManyLazyLoader(O ownerEntity,Class<O> ownerClazz,Class<M> listItemclazz,FinalDb db){
    this.ownerEntity = ownerEntity;
    this.ownerClazz = ownerClazz;
    this.listItemClazz = listItemclazz;
    this.db = db;
}
 
开发者ID:towavephone,项目名称:MemoryCleaner,代码行数:7,代码来源:OneToManyLazyLoader.java


示例5: ManyToOneLazyLoader

import net.tsz.afinal.FinalDb; //导入依赖的package包/类
public ManyToOneLazyLoader(M manyEntity, Class<M> manyClazz, Class<O> oneClazz, FinalDb db){
    this.manyEntity = manyEntity;
    this.manyClazz = manyClazz;
    this.oneClazz = oneClazz;
    this.db = db;
}
 
开发者ID:towavephone,项目名称:MemoryCleaner,代码行数:7,代码来源:ManyToOneLazyLoader.java


示例6: getEntity

import net.tsz.afinal.FinalDb; //导入依赖的package包/类
public static <T> T getEntity(Cursor cursor, Class<T> clazz,FinalDb db){
	try {
		if(cursor!=null ){
			TableInfo table = TableInfo.get(clazz);
			int columnCount = cursor.getColumnCount();
			if(columnCount>0){
				T  entity = (T) clazz.newInstance();
				for(int i=0;i<columnCount;i++){
					
					String column = cursor.getColumnName(i);
					
					Property property = table.propertyMap.get(column);
					if(property!=null){
						property.setValue(entity, cursor.getString(i));
					}else{
						if(table.getId().getColumn().equals(column)){
							table.getId().setValue(entity,  cursor.getString(i));
						}
					}

				}
                   /**
                    * 处理OneToMany的lazyLoad形式
                    */
                   for(OneToMany oneToManyProp : table.oneToManyMap.values()){
                       if(oneToManyProp.getDataType()==OneToManyLazyLoader.class){
                           OneToManyLazyLoader oneToManyLazyLoader = new OneToManyLazyLoader(entity,clazz,oneToManyProp.getOneClass(),db);
                           oneToManyProp.setValue(entity,oneToManyLazyLoader);
                       }
                   }

                   /**
                    * 处理ManyToOne的lazyLoad形式
                    */
                   for(ManyToOne manyToOneProp : table.manyToOneMap.values()){
                       if(manyToOneProp.getDataType()==ManyToOneLazyLoader.class){
                           ManyToOneLazyLoader manyToOneLazyLoader = new ManyToOneLazyLoader(entity,clazz,manyToOneProp.getManyClass(),db);
                           manyToOneLazyLoader.setFieldValue(cursor.getInt(cursor.getColumnIndex(manyToOneProp.getColumn())));
                           manyToOneProp.setValue(entity,manyToOneLazyLoader);
                       }
                   }
				return entity;
			}
		}
	} catch (Exception e) {
		e.printStackTrace();
	}
	
	return null;
}
 
开发者ID:towavephone,项目名称:MemoryCleaner,代码行数:51,代码来源:CursorUtils.java


示例7: AppsPresenter

import net.tsz.afinal.FinalDb; //导入依赖的package包/类
@Inject
public AppsPresenter(
        @ContextLifeCycle("Activity") Context context, FinalDb finalDb) {
    this.mContext = context;
    this.mFinalDb = finalDb;
}
 
开发者ID:towavephone,项目名称:MemoryCleaner,代码行数:7,代码来源:AppsPresenter.java


示例8: MemoryCleanPresenter

import net.tsz.afinal.FinalDb; //导入依赖的package包/类
@Inject
public MemoryCleanPresenter(
        @ContextLifeCycle("Activity") Context context, FinalDb finalDb) {
    this.mContext = context;
    this.mFinalDb = finalDb;
}
 
开发者ID:towavephone,项目名称:MemoryCleaner,代码行数:7,代码来源:MemoryCleanPresenter.java


示例9: provideFinalDb

import net.tsz.afinal.FinalDb; //导入依赖的package包/类
@Provides @Singleton FinalDb provideFinalDb(FinalDb.DaoConfig config) {
    return FinalDb.create(config);
}
 
开发者ID:towavephone,项目名称:MemoryCleaner,代码行数:4,代码来源:AppModule.java


示例10: getIgnoreApps

import net.tsz.afinal.FinalDb; //导入依赖的package包/类
public Observable<List<Ignore>> getIgnoreApps(FinalDb finalDb, Context context) {
    return create(new getIgnoreAppsFun(finalDb, context));
}
 
开发者ID:towavephone,项目名称:MemoryCleaner,代码行数:4,代码来源:ObservableUtils.java


示例11: getIgnoreAppsFun

import net.tsz.afinal.FinalDb; //导入依赖的package包/类
public getIgnoreAppsFun(FinalDb finalDb, Context context) {
    this.mFinalDb = finalDb;
    this.mContext = context;
}
 
开发者ID:towavephone,项目名称:MemoryCleaner,代码行数:5,代码来源:ObservableUtils.java


示例12: onViewCreated

import net.tsz.afinal.FinalDb; //导入依赖的package包/类
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
	super.onViewCreated(view, savedInstanceState);

	Context context = getActivity();
	DebugLog.v(TAG, "onViewCreate");
	setTitleText(R.string.myMessageFragment_title);

	finalDb = FinalDb.create(context, "pushMessage.db");

	listMessage = finalDb.findAll(PushMessage.class);

	if (listMessage.isEmpty())
		DebugLog.v(TAG, "empty");
	else {
		DebugLog.v(TAG, "size" + listMessage.size());
	}
	// 初始化view
	initView(context);

	// 设置监听swipListView
	initSwipeMenuListView(context);

	mAdapter = new SwipeAdapter();
	listView.setAdapter(mAdapter);

	// 设置stateView 加载进度

	LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT,
			LayoutParams.MATCH_PARENT);
	lp.addRule(RelativeLayout.BELOW, ID_TITLE_BAR);
	lp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);

	stateView = new StateView(context);
	appendView(stateView, lp);

	// 判断是否有消息
	if (listMessage.isEmpty()) {
		stateView.showErrorNoButton(getResources().getString(R.string.myMessageFragment_untreated_message));
	} else {
		stateView.setVisibility(View.GONE);
	}

}
 
开发者ID:leleliu008,项目名称:Newton_for_Android_AS,代码行数:45,代码来源:MyMessageFragment.java


示例13: PushManager

import net.tsz.afinal.FinalDb; //导入依赖的package包/类
private PushManager() {
	db = FinalDb.create(MyApp.getApp(), "pushMessage.db");
	observable = new Observable<PushMessage>();
}
 
开发者ID:leleliu008,项目名称:Newton_for_Android_AS,代码行数:5,代码来源:PushManager.java


示例14: downloadFromBreakpoint

import net.tsz.afinal.FinalDb; //导入依赖的package包/类
/**
 * 从断点处开始下载
 */
private static void downloadFromBreakpoint(final DownloadInfo cachedDownloadInfo, GeneralInfo generalInfo, final FinalDb db, final DownLoadListener listener) {
	DebugLog.d(TAG, "downloadFromBreakpoint() generalInfo = " + generalInfo);
	
	if (cachedDownloadInfo == null || generalInfo == null || db == null) {
		return;
	}
	
	//getBlocks
	if (generalInfo.getOriginalUrl().equals(cachedDownloadInfo.getOriginalUrl())
			&& generalInfo.getRedirectUrl().equals(cachedDownloadInfo.getRedirectUrl())
			&& generalInfo.getMimeType().equals(cachedDownloadInfo.getMimeType())
			&& generalInfo.geteTag().equals(cachedDownloadInfo.getETag())
			&& generalInfo.getFilePath().equals(cachedDownloadInfo.getFilePath())
			&& generalInfo.getContentLength() == cachedDownloadInfo.getContentLength()) {
		
		List<BlockInfo> blockInfos = new ArrayList<BlockInfo>();
		cachedDownloadInfo.setBlockInfos(blockInfos);
		
		String blocks = cachedDownloadInfo.getBlocks();
		try {
			JSONArray jsonArray = new JSONArray(blocks);
			for (int i = 0; i < jsonArray.length(); i++) {
				BlockInfo blockInfo = BlockInfo.parse(jsonArray.getJSONObject(i));
				blockInfos.add(blockInfo);
				
				long startPos = blockInfo.getStartPos();
				long endPos = blockInfo.getEndPos();
				long currentPos = blockInfo.getCurrentPos();
				
				//如果没有下载完,就接着下载
				if (startPos < endPos && currentPos < endPos) {
					asyncDownloadPart(generalInfo.getOriginalUrl(), cachedDownloadInfo.getFilePath(), blockInfo);
				}
			}
		} catch (Exception e) {
			DebugLog.e(TAG, "", e);
		}
		
		if (listener != null) {
			updateProgress(cachedDownloadInfo, db, listener);
		}
	} else {
		multiThreadDownload(generalInfo, db, listener);
	}
}
 
开发者ID:leleliu008,项目名称:Newton_for_Android_AS,代码行数:49,代码来源:DownloadBinder.java


示例15: updateProgress

import net.tsz.afinal.FinalDb; //导入依赖的package包/类
/**
 * 更新分段下载的进度
 * 
 */
private static void updateProgress(final DownloadInfo downloadInfo, final FinalDb db, final DownLoadListener listener) {
	//更新进度的线程
	ThreadPoolManager.EXECUTOR.execute(new Runnable() {
		
		@Override
		public void run() {
			while (true) {
				JSONArray jsonArray = new JSONArray();
				
				long currentPos = 0L;
				List<BlockInfo> blockInfos = downloadInfo.getBlockInfos();
				for (BlockInfo blockInfo : blockInfos) {
					currentPos += (blockInfo.getCurrentPos() - blockInfo.getStartPos());
					
					jsonArray.put(blockInfo.toJson());
				}
				downloadInfo.setBlocks(jsonArray.toString());
				
				db.update(downloadInfo, "originalUrl = '" + downloadInfo.getOriginalUrl() + "'");
				
				long contentLength = downloadInfo.getContentLength();
				
				DebugLog.d(TAG, "currentPos = " + currentPos + " ,contentLength = " + contentLength);
				
				listener.onProgress(currentPos, contentLength);
				
				//突然无网络了
				if (!Environment.getInstance().isNetworkAvailable()) {
					if (listener != null) {
						listener.onError(-1);
					}
					break;
				}
				//下载完成了,跳出循环
				if (currentPos == contentLength) {
					break;
				}
				
				//500ms刷新一次
				try {
					Thread.sleep(500);
				} catch (InterruptedException e) {
					DebugLog.e(TAG, "", e);
				}
			}
		}
	});
}
 
开发者ID:leleliu008,项目名称:Newton_for_Android_AS,代码行数:53,代码来源:DownloadBinder.java


示例16: finalDb

import net.tsz.afinal.FinalDb; //导入依赖的package包/类
FinalDb finalDb(); 
开发者ID:towavephone,项目名称:MemoryCleaner,代码行数:2,代码来源:AppComponent.java


示例17: daoConfig

import net.tsz.afinal.FinalDb; //导入依赖的package包/类
FinalDb.DaoConfig daoConfig(); 
开发者ID:towavephone,项目名称:MemoryCleaner,代码行数:2,代码来源:AppComponent.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RegistryConstants类代码示例发布时间:2022-05-22
下一篇:
Java LinkService类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap