package com.example.dao;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import com.example.model.Word;
import com.example.model.WordRecord;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.TreeMap;
public class WordRecordDao {
private DBOpenHelper helper;
private SQLiteDatabase db;
private Context context;
//构造方法
public WordRecordDao(Context context){
this.context=context;
}
//添加方法
public void add(WordRecord wordRecord) {
helper=new DBOpenHelper(context);
db=helper.getReadableDatabase();
ContentValues values=new ContentValues();
values.put("wordId", wordRecord.getWordId());
values.put("isFalse", wordRecord.getIsFalse());
values.put("isFlag", wordRecord.getIsFlag());
values.put("reperaNum", wordRecord.getReperaNum());
values.put("timeFirst", wordRecord.getTimeFirst());
values.put("timeFinish", wordRecord.getTimeFinish());
db.insert("tb_wordrecord",null,values);
//关闭数据库
db.close();
helper.close();
}
//更新方法
public void update(WordRecord wordRecord) {
helper=new DBOpenHelper(context);
db=helper.getReadableDatabase();
ContentValues values=new ContentValues();
values.put("wordId", wordRecord.getWordId());
values.put("isFalse", wordRecord.getIsFalse());
values.put("isFlag", wordRecord.getIsFlag());
values.put("reperaNum", wordRecord.getReperaNum());
values.put("timeFirst", wordRecord.getTimeFirst());
values.put("timeFinish", wordRecord.getTimeFinish());
db.update("tb_wordrecord",values,"wordId=?",new String[]{String.valueOf(wordRecord.getWordId())});
//关闭数据库
db.close();
helper.close();
}
//查找方法
public WordRecord find(Word word) {
helper=new DBOpenHelper(context);
db=helper.getReadableDatabase();
String sql="select * from tb_wordrecord where wordId=?";
Cursor cursor=db.rawQuery(sql,new String[]{String.valueOf(word.get_id())});
if (cursor.moveToNext()){
int _id=cursor.getInt(cursor.getColumnIndex("_id"));
int wordId=cursor.getInt(cursor.getColumnIndex("wordId"));
int isFalse=cursor.getInt(cursor.getColumnIndex("isFalse"));
int isFlag=cursor.getInt(cursor.getColumnIndex("isFlag"));
int reperaNum=cursor.getInt(cursor.getColumnIndex("reperaNum"));
long timeFirst=cursor.getLong(cursor.getColumnIndex("timeFirst"));
long timeFinish=cursor.getLong(cursor.getColumnIndex("timeFinish"));
WordRecord wordRecord =new WordRecord(_id,wordId,isFalse,isFlag,reperaNum,timeFirst,timeFinish);
//关闭游标和数据库
cursor.close();
db.close();
helper.close();
return wordRecord;
}
//关闭游标和数据库
cursor.close();
db.close();
helper.close();
return null;
}
//返回本难度所有背过的单词数据
public List<Word> getLearnedWords() {
List<Word> words_list=new ArrayList<Word>();
helper=new DBOpenHelper(context);
db=helper.getReadableDatabase();
SettingDao settingDao=new SettingDao(context);
String type=settingDao.getDifficulty();
String sql="select * from tb_word,tb_wordrecord where tb_word._id=tb_wordrecord.wordId and tb_word.wordType=? and reperaNum>0";
Cursor cursor=db.rawQuery(sql,new String[]{type});
while (cursor.moveToNext()){
int _id=cursor.getInt(cursor.getColumnIndex("wordId"));
int wordRank=cursor.getInt(cursor.getColumnIndex("wordRank"));
String headWord=cursor.getString(cursor.getColumnIndex("headWord"));
String sentences=cursor.getString(cursor.getColumnIndex("sentences"));
String usphone=cursor.getString(cursor.getColumnIndex("usphone"));
String ukphone=cursor.getString(cursor.getColumnIndex("ukphone"));
String syno=cursor.getString(cursor.getColumnIndex("syno"));
String phrases=cursor.getString(cursor.getColumnIndex("phrases"));
String tranCN=cursor.getString(cursor.getColumnIndex("tranCN"));
String tranEN=cursor.getString(cursor.getColumnIndex("tranEN"));
String wordType=cursor.getString(cursor.getColumnIndex("wordType"));
Word word=new Word(_id,wordRank,headWord,sentences,usphone,ukphone,syno,phrases,tranCN,tranEN,wordType);
words_list.add(word);
}
cursor.close();
db.close();
helper.close();
return words_list;
}
//返回本难度所有背过的单词数据
public List<Word> getLearnedWords(String type) {
List<Word> words_list=new ArrayList<Word>();
helper=new DBOpenHelper(context);
db=helper.getReadableDatabase();
String sql="select * from tb_word,tb_wordrecord where tb_word._id=tb_wordrecord.wordId and tb_word.wordType=? and reperaNum>0";
Cursor cursor=db.rawQuery(sql,new String[]{type});
while (cursor.moveToNext()){
int _id=cursor.getInt(cursor.getColumnIndex("wordId"));
int wordRank=cursor.getInt(cursor.getColumnIndex("wordRank"));
String headWord=cursor.getString(cursor.getColumnIndex("headWord"));
String sentences=cursor.getString(cursor.getColumnIndex("sentences"));
String usphone=cursor.getString(cursor.getColumnIndex("usphone"));
String ukphone=cursor.getString(cursor.getColumnIndex("ukphone"));
String syno=cursor.getString(cursor.getColumnIndex("syno"));
String phrases=cursor.getString(cursor.getColumnIndex("phrases"));
String tranCN=cursor.getString(cursor.getColumnIndex("tranCN"));
String tranEN=cursor.getString(cursor.getColumnIndex("tranEN"));
String wordType=cursor.getString(cursor.getColumnIndex("wordType"));
Word word=new Word(_id,wordRank,headWord,sentences,usphone,ukphone,syno,phrases,tranCN,tranEN,wordType);
words_list.add(word);
}
cursor.close();
db.close();
helper.close();
return words_list;
}
//返回本难度需复习的单词数据
public List<Word> getNeedReWords(int todayneedreview) {
List<Word> words_list=new ArrayList<Word>();
helper=new DBOpenHelper(context);
db=helper.getReadableDatabase();
SettingDao settingDao=new SettingDao(context);
String type=settingDao.getDifficulty();
String sql="select * from tb_word,tb_wordrecord where tb_word._id=tb_wordrecord.wordId and reperaNum<5 and reperaNum>=1 and tb_word.wordType=? order by timeFirst ASC limit ?";
Cursor cursor=db.rawQuery(sql,new String[]{type,String.valueOf(todayneedreview)});
while (cursor.moveToNext()){
int _id=cursor.getInt(cursor.getColumnIndex("wordId"));
int wordRank=cursor.getInt(cursor.getColumnIndex("wordRank"));
String headWord=cursor.getString(cursor.getColumnIndex("headWord"));
String sentences=cursor.getString(cursor.getColumnIndex("sentences"));
String usphone=cursor.getString(cursor.getColumnIndex("usphone"));
String ukphone=cursor.getString(cursor.getColumnIndex("ukphone"));
String syno=cursor.getString(cursor.getColumnIndex("syno"));
String phrases=cursor.getString(cursor.getColumnIndex("phrases"));
String tranCN=cursor.getString(cursor.getColumnIndex("tranCN"));
String tranEN=cursor.getString(cursor.getColumnIndex("tranEN"));
String wordType=cursor.getString(cur
没有合适的资源?快使用搜索试试~ 我知道了~
基于Android Studio开发的单词本APP源码(安卓期末大作业).zip
共275个文件
xml:155个
java:75个
jpg:11个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
5星 · 超过95%的资源 9 下载量 107 浏览量
2023-02-09
20:16:31
上传
评论 29
收藏 6.36MB ZIP 举报
温馨提示
基于Android Studio开发的单词本APP源码(安卓期末大作业).zip 95分以上高分项目,下载即用无需修改,代码完整确保可以运行。 基于Android Studio开发的单词本APP源码(安卓期末大作业).zip 95分以上高分项目,下载即用无需修改,代码完整确保可以运行。基于Android Studio开发的单词本APP源码(安卓期末大作业).zip 95分以上高分项目,下载即用无需修改,代码完整确保可以运行。基于Android Studio开发的单词本APP源码(安卓期末大作业).zip 95分以上高分项目,下载即用无需修改,代码完整确保可以运行。基于Android Studio开发的单词本APP源码(安卓期末大作业).zip 95分以上高分项目,下载即用无需修改,代码完整确保可以运行。基于Android Studio开发的单词本APP源码(安卓期末大作业).zip 95分以上高分项目,下载即用无需修改,代码完整确保可以运行。基于Android Studio开发的单词本APP源码(安卓期末大作业).zip 95分以上高分项目,下载即用无需修改,代码完
资源推荐
资源详情
资源评论
收起资源包目录
基于Android Studio开发的单词本APP源码(安卓期末大作业).zip (275个子文件)
gradlew.bat 2KB
gradlew.bat 2KB
now_word.db 5.03MB
.gitignore 1KB
.gitignore 6B
build.gradle 3KB
build.gradle 617B
settings.gradle 44B
gradlew 5KB
gradlew 5KB
commons-net-3.7.2-sources.jar 427KB
open_sdk_3.5.2.152_r9e04b1c_lite.jar 315KB
commons-net-3.7.2.jar 300KB
gson-2.8.5.jar 236KB
commons-net-examples-3.7.2.jar 90KB
gradle-wrapper.jar 53KB
gradle-wrapper.jar 53KB
WordRecordDao.java 41KB
MPAndroidBarChart.java 22KB
PictureResultActivity.java 21KB
TakePictureActivity.java 20KB
WordBookFragment.java 19KB
MainStudyActivity.java 19KB
WordStudyActivity.java 18KB
WordDao.java 18KB
TabFragment.java 17KB
SockScreenActivity.java 13KB
SearchWordActivity.java 12KB
OWLoadingView.java 11KB
SettingActivity.java 11KB
MainHomeActivity.java 10KB
QQLoginManager.java 10KB
SettingDao.java 10KB
DictateWordStudyActivity.java 9KB
FTPManager.java 8KB
StatisticsActivity.java 8KB
MPAndroidLineChart.java 7KB
HomeFragment.java 7KB
MPAndroidCombineChart.java 6KB
StudyRecordDao.java 6KB
WordDetailsActivity.java 6KB
MyWelcomeActivity.java 5KB
HttpGet.java 5KB
ReviewFragment.java 5KB
WordBookAdapter.java 4KB
WordTypeDao.java 4KB
LoginActivity.java 4KB
Word.java 4KB
WordAdapter.java 4KB
LauncherActivity.java 4KB
MPAndroidPieChart.java 4KB
MD5.java 4KB
ArrowTextView.java 4KB
LockScreenService.java 3KB
AudioMediaPlayer.java 3KB
WordListActivity.java 3KB
Setting.java 3KB
BaiduGetToken.java 3KB
HttpUtil.java 3KB
Base64Util.java 3KB
StudyRecord.java 2KB
WordRecord.java 2KB
DBOpenHelper.java 2KB
FileUtil.java 2KB
CoverFlowAdapter.java 2KB
WisdomDao.java 2KB
BaiduOCR.java 2KB
AboutActivity.java 2KB
LocalTrueFalseMediaPlayer.java 2KB
MPChartMarkerView.java 2KB
Tran_CN_split.java 2KB
StringUtils.java 1KB
TransApi.java 1KB
DonateActivity.java 1KB
GetStyleTheme.java 1KB
BaseApplication.java 1002B
IsIntenet.java 991B
Wisdom.java 961B
SelectZhengImage.java 914B
FragmentAdapter.java 881B
NoScrollViewPager.java 862B
LockScreenReceiver.java 853B
WordType.java 833B
GsonUtils.java 813B
ExampleInstrumentedTest.java 754B
FirstInto.java 710B
StringAxisValueFormatter.java 690B
MyValueFormatter.java 448B
ExampleUnitTest.java 381B
ReviewCardEntity.java 367B
WordBookEntity.java 293B
Sentence_split.java 208B
donate_zhifubao.jpg 230KB
welcome_pager_two.jpg 174KB
welcome_pager_one.jpg 125KB
slide_header_img.jpg 120KB
welcome_pager_three.jpg 116KB
welcome_pager_four.jpg 77KB
sock_screen_background.jpg 46KB
review_birds.jpg 32KB
共 275 条
- 1
- 2
- 3
猰貐的新时代
- 粉丝: 1w+
- 资源: 2554
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- Whisper-v1.0.0.2-x64-setup.exe
- java固定资产管理系统源码数据库 MySQL源码类型 WebForm
- mmexport1731941345010.jpg
- C#机械制造业信息管理系统源码数据库 Access源码类型 WinForm
- 【python毕业设计】智能旅游推荐系统源码(完整前后端+mysql+说明文档+LW).zip
- springboot美容院管理系统(代码+数据库+LW)
- 【python毕业设计】学生成绩管理系统源码(完整前后端+mysql+说明文档+LW).zip
- 商道融绿、润灵环球ESG评级数据(2015-2023年)dta
- 【python毕业设计】疫情数据可视化分析系统源码(完整前后端+mysql+说明文档+LW).zip
- elasticsearch-analysis-dynamic-synonym 8.16.0
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
- 4
前往页