Commit 8e191b0a authored by hywang's avatar hywang

1.重新做配种模块逻辑,增加冻精搜索页面。

parent e0d1879c
...@@ -9,8 +9,8 @@ android { ...@@ -9,8 +9,8 @@ android {
applicationId "com.phlx.anchorcollect_p" applicationId "com.phlx.anchorcollect_p"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 29 targetSdkVersion 29
versionCode 21 versionCode 22
versionName "2.2.1" versionName "2.3.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
...@@ -50,7 +50,7 @@ android { ...@@ -50,7 +50,7 @@ android {
} }
greendao { greendao {
schemaVersion 5 //数据库版本号 schemaVersion 6 //数据库版本号
daoPackage 'com.phlx.anchorcollect_p.db.gen' daoPackage 'com.phlx.anchorcollect_p.db.gen'
targetGenDir 'src/main/java' targetGenDir 'src/main/java'
} }
......
...@@ -27,22 +27,25 @@ public class BreedingRecordDetailEntityDao extends AbstractDao<BreedingRecordDet ...@@ -27,22 +27,25 @@ public class BreedingRecordDetailEntityDao extends AbstractDao<BreedingRecordDet
public final static Property Unid = new Property(0, Long.class, "unid", true, "_id"); public final static Property Unid = new Property(0, Long.class, "unid", true, "_id");
public final static Property FUnid = new Property(1, Long.class, "fUnid", false, "F_UNID"); public final static Property FUnid = new Property(1, Long.class, "fUnid", false, "F_UNID");
public final static Property MatingStyle = new Property(2, String.class, "matingStyle", false, "MATING_STYLE"); public final static Property MatingStyle = new Property(2, String.class, "matingStyle", false, "MATING_STYLE");
public final static Property CattleresumeId = new Property(3, Long.class, "cattleresumeId", false, "CATTLERESUME_ID"); public final static Property CattleresumeId = new Property(3, String.class, "cattleresumeId", false, "CATTLERESUME_ID");
public final static Property FrozenSemenBatch = new Property(4, String.class, "frozenSemenBatch", false, "FROZEN_SEMEN_BATCH"); public final static Property FrozenSemenBatch = new Property(4, String.class, "frozenSemenBatch", false, "FROZEN_SEMEN_BATCH");
public final static Property MatingDate = new Property(5, String.class, "matingDate", false, "MATING_DATE"); public final static Property Other = new Property(5, String.class, "other", false, "OTHER");
public final static Property IsReturn = new Property(6, String.class, "isReturn", false, "IS_RETURN"); public final static Property MatingDate = new Property(6, String.class, "matingDate", false, "MATING_DATE");
public final static Property BackLoveDate = new Property(7, String.class, "backLoveDate", false, "BACK_LOVE_DATE"); public final static Property IsReturn = new Property(7, String.class, "isReturn", false, "IS_RETURN");
public final static Property DueDate = new Property(8, String.class, "dueDate", false, "DUE_DATE"); public final static Property BackLoveDate = new Property(8, String.class, "backLoveDate", false, "BACK_LOVE_DATE");
public final static Property Pregnancy = new Property(9, String.class, "pregnancy", false, "PREGNANCY"); public final static Property DueDate = new Property(9, String.class, "dueDate", false, "DUE_DATE");
public final static Property DeptId = new Property(10, Long.class, "deptId", false, "DEPT_ID"); public final static Property Pregnancy = new Property(10, String.class, "pregnancy", false, "PREGNANCY");
public final static Property CaId = new Property(11, Long.class, "caId", false, "CA_ID"); public final static Property RaiseVarieties = new Property(11, String.class, "raiseVarieties", false, "RAISE_VARIETIES");
public final static Property UploadStatus = new Property(12, String.class, "uploadStatus", false, "UPLOAD_STATUS"); public final static Property BreedingPlantId = new Property(12, String.class, "breedingPlantId", false, "BREEDING_PLANT_ID");
public final static Property SearchValue = new Property(13, String.class, "searchValue", false, "SEARCH_VALUE"); public final static Property DeptId = new Property(13, Long.class, "deptId", false, "DEPT_ID");
public final static Property CreateBy = new Property(14, String.class, "createBy", false, "CREATE_BY"); public final static Property CaId = new Property(14, Long.class, "caId", false, "CA_ID");
public final static Property CreateTime = new Property(15, String.class, "createTime", false, "CREATE_TIME"); public final static Property UploadStatus = new Property(15, String.class, "uploadStatus", false, "UPLOAD_STATUS");
public final static Property UpdateBy = new Property(16, String.class, "updateBy", false, "UPDATE_BY"); public final static Property SearchValue = new Property(16, String.class, "searchValue", false, "SEARCH_VALUE");
public final static Property UpdateTime = new Property(17, String.class, "updateTime", false, "UPDATE_TIME"); public final static Property CreateBy = new Property(17, String.class, "createBy", false, "CREATE_BY");
public final static Property Remark = new Property(18, String.class, "remark", false, "REMARK"); public final static Property CreateTime = new Property(18, String.class, "createTime", false, "CREATE_TIME");
public final static Property UpdateBy = new Property(19, String.class, "updateBy", false, "UPDATE_BY");
public final static Property UpdateTime = new Property(20, String.class, "updateTime", false, "UPDATE_TIME");
public final static Property Remark = new Property(21, String.class, "remark", false, "REMARK");
} }
...@@ -61,22 +64,25 @@ public class BreedingRecordDetailEntityDao extends AbstractDao<BreedingRecordDet ...@@ -61,22 +64,25 @@ public class BreedingRecordDetailEntityDao extends AbstractDao<BreedingRecordDet
"\"_id\" INTEGER PRIMARY KEY ," + // 0: unid "\"_id\" INTEGER PRIMARY KEY ," + // 0: unid
"\"F_UNID\" INTEGER," + // 1: fUnid "\"F_UNID\" INTEGER," + // 1: fUnid
"\"MATING_STYLE\" TEXT," + // 2: matingStyle "\"MATING_STYLE\" TEXT," + // 2: matingStyle
"\"CATTLERESUME_ID\" INTEGER," + // 3: cattleresumeId "\"CATTLERESUME_ID\" TEXT," + // 3: cattleresumeId
"\"FROZEN_SEMEN_BATCH\" TEXT," + // 4: frozenSemenBatch "\"FROZEN_SEMEN_BATCH\" TEXT," + // 4: frozenSemenBatch
"\"MATING_DATE\" TEXT," + // 5: matingDate "\"OTHER\" TEXT," + // 5: other
"\"IS_RETURN\" TEXT," + // 6: isReturn "\"MATING_DATE\" TEXT," + // 6: matingDate
"\"BACK_LOVE_DATE\" TEXT," + // 7: backLoveDate "\"IS_RETURN\" TEXT," + // 7: isReturn
"\"DUE_DATE\" TEXT," + // 8: dueDate "\"BACK_LOVE_DATE\" TEXT," + // 8: backLoveDate
"\"PREGNANCY\" TEXT," + // 9: pregnancy "\"DUE_DATE\" TEXT," + // 9: dueDate
"\"DEPT_ID\" INTEGER," + // 10: deptId "\"PREGNANCY\" TEXT," + // 10: pregnancy
"\"CA_ID\" INTEGER," + // 11: caId "\"RAISE_VARIETIES\" TEXT," + // 11: raiseVarieties
"\"UPLOAD_STATUS\" TEXT," + // 12: uploadStatus "\"BREEDING_PLANT_ID\" TEXT," + // 12: breedingPlantId
"\"SEARCH_VALUE\" TEXT," + // 13: searchValue "\"DEPT_ID\" INTEGER," + // 13: deptId
"\"CREATE_BY\" TEXT," + // 14: createBy "\"CA_ID\" INTEGER," + // 14: caId
"\"CREATE_TIME\" TEXT," + // 15: createTime "\"UPLOAD_STATUS\" TEXT," + // 15: uploadStatus
"\"UPDATE_BY\" TEXT," + // 16: updateBy "\"SEARCH_VALUE\" TEXT," + // 16: searchValue
"\"UPDATE_TIME\" TEXT," + // 17: updateTime "\"CREATE_BY\" TEXT," + // 17: createBy
"\"REMARK\" TEXT);"); // 18: remark "\"CREATE_TIME\" TEXT," + // 18: createTime
"\"UPDATE_BY\" TEXT," + // 19: updateBy
"\"UPDATE_TIME\" TEXT," + // 20: updateTime
"\"REMARK\" TEXT);"); // 21: remark
} }
/** Drops the underlying database table. */ /** Drops the underlying database table. */
...@@ -104,9 +110,9 @@ public class BreedingRecordDetailEntityDao extends AbstractDao<BreedingRecordDet ...@@ -104,9 +110,9 @@ public class BreedingRecordDetailEntityDao extends AbstractDao<BreedingRecordDet
stmt.bindString(3, matingStyle); stmt.bindString(3, matingStyle);
} }
Long cattleresumeId = entity.getCattleresumeId(); String cattleresumeId = entity.getCattleresumeId();
if (cattleresumeId != null) { if (cattleresumeId != null) {
stmt.bindLong(4, cattleresumeId); stmt.bindString(4, cattleresumeId);
} }
String frozenSemenBatch = entity.getFrozenSemenBatch(); String frozenSemenBatch = entity.getFrozenSemenBatch();
...@@ -114,74 +120,89 @@ public class BreedingRecordDetailEntityDao extends AbstractDao<BreedingRecordDet ...@@ -114,74 +120,89 @@ public class BreedingRecordDetailEntityDao extends AbstractDao<BreedingRecordDet
stmt.bindString(5, frozenSemenBatch); stmt.bindString(5, frozenSemenBatch);
} }
String other = entity.getOther();
if (other != null) {
stmt.bindString(6, other);
}
String matingDate = entity.getMatingDate(); String matingDate = entity.getMatingDate();
if (matingDate != null) { if (matingDate != null) {
stmt.bindString(6, matingDate); stmt.bindString(7, matingDate);
} }
String isReturn = entity.getIsReturn(); String isReturn = entity.getIsReturn();
if (isReturn != null) { if (isReturn != null) {
stmt.bindString(7, isReturn); stmt.bindString(8, isReturn);
} }
String backLoveDate = entity.getBackLoveDate(); String backLoveDate = entity.getBackLoveDate();
if (backLoveDate != null) { if (backLoveDate != null) {
stmt.bindString(8, backLoveDate); stmt.bindString(9, backLoveDate);
} }
String dueDate = entity.getDueDate(); String dueDate = entity.getDueDate();
if (dueDate != null) { if (dueDate != null) {
stmt.bindString(9, dueDate); stmt.bindString(10, dueDate);
} }
String pregnancy = entity.getPregnancy(); String pregnancy = entity.getPregnancy();
if (pregnancy != null) { if (pregnancy != null) {
stmt.bindString(10, pregnancy); stmt.bindString(11, pregnancy);
}
String raiseVarieties = entity.getRaiseVarieties();
if (raiseVarieties != null) {
stmt.bindString(12, raiseVarieties);
}
String breedingPlantId = entity.getBreedingPlantId();
if (breedingPlantId != null) {
stmt.bindString(13, breedingPlantId);
} }
Long deptId = entity.getDeptId(); Long deptId = entity.getDeptId();
if (deptId != null) { if (deptId != null) {
stmt.bindLong(11, deptId); stmt.bindLong(14, deptId);
} }
Long caId = entity.getCaId(); Long caId = entity.getCaId();
if (caId != null) { if (caId != null) {
stmt.bindLong(12, caId); stmt.bindLong(15, caId);
} }
String uploadStatus = entity.getUploadStatus(); String uploadStatus = entity.getUploadStatus();
if (uploadStatus != null) { if (uploadStatus != null) {
stmt.bindString(13, uploadStatus); stmt.bindString(16, uploadStatus);
} }
String searchValue = entity.getSearchValue(); String searchValue = entity.getSearchValue();
if (searchValue != null) { if (searchValue != null) {
stmt.bindString(14, searchValue); stmt.bindString(17, searchValue);
} }
String createBy = entity.getCreateBy(); String createBy = entity.getCreateBy();
if (createBy != null) { if (createBy != null) {
stmt.bindString(15, createBy); stmt.bindString(18, createBy);
} }
String createTime = entity.getCreateTime(); String createTime = entity.getCreateTime();
if (createTime != null) { if (createTime != null) {
stmt.bindString(16, createTime); stmt.bindString(19, createTime);
} }
String updateBy = entity.getUpdateBy(); String updateBy = entity.getUpdateBy();
if (updateBy != null) { if (updateBy != null) {
stmt.bindString(17, updateBy); stmt.bindString(20, updateBy);
} }
String updateTime = entity.getUpdateTime(); String updateTime = entity.getUpdateTime();
if (updateTime != null) { if (updateTime != null) {
stmt.bindString(18, updateTime); stmt.bindString(21, updateTime);
} }
String remark = entity.getRemark(); String remark = entity.getRemark();
if (remark != null) { if (remark != null) {
stmt.bindString(19, remark); stmt.bindString(22, remark);
} }
} }
...@@ -204,9 +225,9 @@ public class BreedingRecordDetailEntityDao extends AbstractDao<BreedingRecordDet ...@@ -204,9 +225,9 @@ public class BreedingRecordDetailEntityDao extends AbstractDao<BreedingRecordDet
stmt.bindString(3, matingStyle); stmt.bindString(3, matingStyle);
} }
Long cattleresumeId = entity.getCattleresumeId(); String cattleresumeId = entity.getCattleresumeId();
if (cattleresumeId != null) { if (cattleresumeId != null) {
stmt.bindLong(4, cattleresumeId); stmt.bindString(4, cattleresumeId);
} }
String frozenSemenBatch = entity.getFrozenSemenBatch(); String frozenSemenBatch = entity.getFrozenSemenBatch();
...@@ -214,74 +235,89 @@ public class BreedingRecordDetailEntityDao extends AbstractDao<BreedingRecordDet ...@@ -214,74 +235,89 @@ public class BreedingRecordDetailEntityDao extends AbstractDao<BreedingRecordDet
stmt.bindString(5, frozenSemenBatch); stmt.bindString(5, frozenSemenBatch);
} }
String other = entity.getOther();
if (other != null) {
stmt.bindString(6, other);
}
String matingDate = entity.getMatingDate(); String matingDate = entity.getMatingDate();
if (matingDate != null) { if (matingDate != null) {
stmt.bindString(6, matingDate); stmt.bindString(7, matingDate);
} }
String isReturn = entity.getIsReturn(); String isReturn = entity.getIsReturn();
if (isReturn != null) { if (isReturn != null) {
stmt.bindString(7, isReturn); stmt.bindString(8, isReturn);
} }
String backLoveDate = entity.getBackLoveDate(); String backLoveDate = entity.getBackLoveDate();
if (backLoveDate != null) { if (backLoveDate != null) {
stmt.bindString(8, backLoveDate); stmt.bindString(9, backLoveDate);
} }
String dueDate = entity.getDueDate(); String dueDate = entity.getDueDate();
if (dueDate != null) { if (dueDate != null) {
stmt.bindString(9, dueDate); stmt.bindString(10, dueDate);
} }
String pregnancy = entity.getPregnancy(); String pregnancy = entity.getPregnancy();
if (pregnancy != null) { if (pregnancy != null) {
stmt.bindString(10, pregnancy); stmt.bindString(11, pregnancy);
}
String raiseVarieties = entity.getRaiseVarieties();
if (raiseVarieties != null) {
stmt.bindString(12, raiseVarieties);
}
String breedingPlantId = entity.getBreedingPlantId();
if (breedingPlantId != null) {
stmt.bindString(13, breedingPlantId);
} }
Long deptId = entity.getDeptId(); Long deptId = entity.getDeptId();
if (deptId != null) { if (deptId != null) {
stmt.bindLong(11, deptId); stmt.bindLong(14, deptId);
} }
Long caId = entity.getCaId(); Long caId = entity.getCaId();
if (caId != null) { if (caId != null) {
stmt.bindLong(12, caId); stmt.bindLong(15, caId);
} }
String uploadStatus = entity.getUploadStatus(); String uploadStatus = entity.getUploadStatus();
if (uploadStatus != null) { if (uploadStatus != null) {
stmt.bindString(13, uploadStatus); stmt.bindString(16, uploadStatus);
} }
String searchValue = entity.getSearchValue(); String searchValue = entity.getSearchValue();
if (searchValue != null) { if (searchValue != null) {
stmt.bindString(14, searchValue); stmt.bindString(17, searchValue);
} }
String createBy = entity.getCreateBy(); String createBy = entity.getCreateBy();
if (createBy != null) { if (createBy != null) {
stmt.bindString(15, createBy); stmt.bindString(18, createBy);
} }
String createTime = entity.getCreateTime(); String createTime = entity.getCreateTime();
if (createTime != null) { if (createTime != null) {
stmt.bindString(16, createTime); stmt.bindString(19, createTime);
} }
String updateBy = entity.getUpdateBy(); String updateBy = entity.getUpdateBy();
if (updateBy != null) { if (updateBy != null) {
stmt.bindString(17, updateBy); stmt.bindString(20, updateBy);
} }
String updateTime = entity.getUpdateTime(); String updateTime = entity.getUpdateTime();
if (updateTime != null) { if (updateTime != null) {
stmt.bindString(18, updateTime); stmt.bindString(21, updateTime);
} }
String remark = entity.getRemark(); String remark = entity.getRemark();
if (remark != null) { if (remark != null) {
stmt.bindString(19, remark); stmt.bindString(22, remark);
} }
} }
...@@ -296,22 +332,25 @@ public class BreedingRecordDetailEntityDao extends AbstractDao<BreedingRecordDet ...@@ -296,22 +332,25 @@ public class BreedingRecordDetailEntityDao extends AbstractDao<BreedingRecordDet
cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // unid cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // unid
cursor.isNull(offset + 1) ? null : cursor.getLong(offset + 1), // fUnid cursor.isNull(offset + 1) ? null : cursor.getLong(offset + 1), // fUnid
cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // matingStyle cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // matingStyle
cursor.isNull(offset + 3) ? null : cursor.getLong(offset + 3), // cattleresumeId cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // cattleresumeId
cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // frozenSemenBatch cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // frozenSemenBatch
cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // matingDate cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // other
cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // isReturn cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // matingDate
cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // backLoveDate cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // isReturn
cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // dueDate cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // backLoveDate
cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // pregnancy cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // dueDate
cursor.isNull(offset + 10) ? null : cursor.getLong(offset + 10), // deptId cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // pregnancy
cursor.isNull(offset + 11) ? null : cursor.getLong(offset + 11), // caId cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // raiseVarieties
cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // uploadStatus cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // breedingPlantId
cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // searchValue cursor.isNull(offset + 13) ? null : cursor.getLong(offset + 13), // deptId
cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // createBy cursor.isNull(offset + 14) ? null : cursor.getLong(offset + 14), // caId
cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // createTime cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // uploadStatus
cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // updateBy cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // searchValue
cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // updateTime cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // createBy
cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18) // remark cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // createTime
cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // updateBy
cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // updateTime
cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21) // remark
); );
return entity; return entity;
} }
...@@ -321,22 +360,25 @@ public class BreedingRecordDetailEntityDao extends AbstractDao<BreedingRecordDet ...@@ -321,22 +360,25 @@ public class BreedingRecordDetailEntityDao extends AbstractDao<BreedingRecordDet
entity.setUnid(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setUnid(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
entity.setFUnid(cursor.isNull(offset + 1) ? null : cursor.getLong(offset + 1)); entity.setFUnid(cursor.isNull(offset + 1) ? null : cursor.getLong(offset + 1));
entity.setMatingStyle(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); entity.setMatingStyle(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
entity.setCattleresumeId(cursor.isNull(offset + 3) ? null : cursor.getLong(offset + 3)); entity.setCattleresumeId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
entity.setFrozenSemenBatch(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); entity.setFrozenSemenBatch(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
entity.setMatingDate(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); entity.setOther(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
entity.setIsReturn(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); entity.setMatingDate(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
entity.setBackLoveDate(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); entity.setIsReturn(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
entity.setDueDate(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); entity.setBackLoveDate(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8));
entity.setPregnancy(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); entity.setDueDate(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9));
entity.setDeptId(cursor.isNull(offset + 10) ? null : cursor.getLong(offset + 10)); entity.setPregnancy(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10));
entity.setCaId(cursor.isNull(offset + 11) ? null : cursor.getLong(offset + 11)); entity.setRaiseVarieties(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11));
entity.setUploadStatus(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); entity.setBreedingPlantId(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12));
entity.setSearchValue(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); entity.setDeptId(cursor.isNull(offset + 13) ? null : cursor.getLong(offset + 13));
entity.setCreateBy(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); entity.setCaId(cursor.isNull(offset + 14) ? null : cursor.getLong(offset + 14));
entity.setCreateTime(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); entity.setUploadStatus(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15));
entity.setUpdateBy(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); entity.setSearchValue(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16));
entity.setUpdateTime(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); entity.setCreateBy(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17));
entity.setRemark(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); entity.setCreateTime(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18));
entity.setUpdateBy(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19));
entity.setUpdateTime(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20));
entity.setRemark(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21));
} }
@Override @Override
......
...@@ -14,10 +14,10 @@ import org.greenrobot.greendao.identityscope.IdentityScopeType; ...@@ -14,10 +14,10 @@ import org.greenrobot.greendao.identityscope.IdentityScopeType;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/** /**
* Master of DAO (schema version 5): knows all DAOs. * Master of DAO (schema version 6): knows all DAOs.
*/ */
public class DaoMaster extends AbstractDaoMaster { public class DaoMaster extends AbstractDaoMaster {
public static final int SCHEMA_VERSION = 5; public static final int SCHEMA_VERSION = 6;
/** Creates underlying database table using DAOs. */ /** Creates underlying database table using DAOs. */
public static void createAllTables(Database db, boolean ifNotExists) { public static void createAllTables(Database db, boolean ifNotExists) {
......
...@@ -35,15 +35,20 @@ public class BreedingRecordDetailEntity extends BaseObservable implements Parcel ...@@ -35,15 +35,20 @@ public class BreedingRecordDetailEntity extends BaseObservable implements Parcel
private String matingStyle; private String matingStyle;
/** /**
* 种畜耳标 * 冻精注册
*/ */
private Long cattleresumeId; private String cattleresumeId;
/** /**
* 冻精批次号 * 冻精批次号
*/ */
private String frozenSemenBatch; private String frozenSemenBatch;
/**
* 其它
*/
private String other;
/** /**
* 配种日期 * 配种日期
*/ */
...@@ -69,13 +74,23 @@ public class BreedingRecordDetailEntity extends BaseObservable implements Parcel ...@@ -69,13 +74,23 @@ public class BreedingRecordDetailEntity extends BaseObservable implements Parcel
*/ */
private String pregnancy; private String pregnancy;
/**
* 饲养品种(利木赞;西门塔尔等)
*/
private String raiseVarieties;
/**
* 所属种畜站
*/
private String breedingPlantId;
/** /**
* 部门id * 部门id
*/ */
private Long deptId; private Long deptId;
/** /**
* 部门id * 临时属性 和主表 移动端上传所需(验证数据使用)
*/ */
private Long caId; private Long caId;
...@@ -116,17 +131,16 @@ public class BreedingRecordDetailEntity extends BaseObservable implements Parcel ...@@ -116,17 +131,16 @@ public class BreedingRecordDetailEntity extends BaseObservable implements Parcel
fUnid = in.readLong(); fUnid = in.readLong();
} }
matingStyle = in.readString(); matingStyle = in.readString();
if (in.readByte() == 0) { cattleresumeId = in.readString();
cattleresumeId = null;
} else {
cattleresumeId = in.readLong();
}
frozenSemenBatch = in.readString(); frozenSemenBatch = in.readString();
other = in.readString();
matingDate = in.readString(); matingDate = in.readString();
isReturn = in.readString(); isReturn = in.readString();
backLoveDate = in.readString(); backLoveDate = in.readString();
dueDate = in.readString(); dueDate = in.readString();
pregnancy = in.readString(); pregnancy = in.readString();
raiseVarieties = in.readString();
breedingPlantId = in.readString();
if (in.readByte() == 0) { if (in.readByte() == 0) {
deptId = null; deptId = null;
} else { } else {
...@@ -146,21 +160,25 @@ public class BreedingRecordDetailEntity extends BaseObservable implements Parcel ...@@ -146,21 +160,25 @@ public class BreedingRecordDetailEntity extends BaseObservable implements Parcel
remark = in.readString(); remark = in.readString();
} }
@Generated(hash = 1961071723) @Generated(hash = 2018405645)
public BreedingRecordDetailEntity(Long unid, Long fUnid, String matingStyle, Long cattleresumeId, public BreedingRecordDetailEntity(Long unid, Long fUnid, String matingStyle, String cattleresumeId,
String frozenSemenBatch, String matingDate, String isReturn, String backLoveDate, String dueDate, String frozenSemenBatch, String other, String matingDate, String isReturn, String backLoveDate,
String pregnancy, Long deptId, Long caId, String uploadStatus, String searchValue, String createBy, String dueDate, String pregnancy, String raiseVarieties, String breedingPlantId, Long deptId,
String createTime, String updateBy, String updateTime, String remark) { Long caId, String uploadStatus, String searchValue, String createBy, String createTime,
String updateBy, String updateTime, String remark) {
this.unid = unid; this.unid = unid;
this.fUnid = fUnid; this.fUnid = fUnid;
this.matingStyle = matingStyle; this.matingStyle = matingStyle;
this.cattleresumeId = cattleresumeId; this.cattleresumeId = cattleresumeId;
this.frozenSemenBatch = frozenSemenBatch; this.frozenSemenBatch = frozenSemenBatch;
this.other = other;
this.matingDate = matingDate; this.matingDate = matingDate;
this.isReturn = isReturn; this.isReturn = isReturn;
this.backLoveDate = backLoveDate; this.backLoveDate = backLoveDate;
this.dueDate = dueDate; this.dueDate = dueDate;
this.pregnancy = pregnancy; this.pregnancy = pregnancy;
this.raiseVarieties = raiseVarieties;
this.breedingPlantId = breedingPlantId;
this.deptId = deptId; this.deptId = deptId;
this.caId = caId; this.caId = caId;
this.uploadStatus = uploadStatus; this.uploadStatus = uploadStatus;
...@@ -187,18 +205,16 @@ public class BreedingRecordDetailEntity extends BaseObservable implements Parcel ...@@ -187,18 +205,16 @@ public class BreedingRecordDetailEntity extends BaseObservable implements Parcel
dest.writeLong(fUnid); dest.writeLong(fUnid);
} }
dest.writeString(matingStyle); dest.writeString(matingStyle);
if (cattleresumeId == null) { dest.writeString(cattleresumeId);
dest.writeByte((byte) 0);
} else {
dest.writeByte((byte) 1);
dest.writeLong(cattleresumeId);
}
dest.writeString(frozenSemenBatch); dest.writeString(frozenSemenBatch);
dest.writeString(other);
dest.writeString(matingDate); dest.writeString(matingDate);
dest.writeString(isReturn); dest.writeString(isReturn);
dest.writeString(backLoveDate); dest.writeString(backLoveDate);
dest.writeString(dueDate); dest.writeString(dueDate);
dest.writeString(pregnancy); dest.writeString(pregnancy);
dest.writeString(raiseVarieties);
dest.writeString(breedingPlantId);
if (deptId == null) { if (deptId == null) {
dest.writeByte((byte) 0); dest.writeByte((byte) 0);
} else { } else {
...@@ -261,11 +277,11 @@ public class BreedingRecordDetailEntity extends BaseObservable implements Parcel ...@@ -261,11 +277,11 @@ public class BreedingRecordDetailEntity extends BaseObservable implements Parcel
this.matingStyle = matingStyle; this.matingStyle = matingStyle;
} }
public Long getCattleresumeId() { public String getCattleresumeId() {
return cattleresumeId; return cattleresumeId;
} }
public void setCattleresumeId(Long cattleresumeId) { public void setCattleresumeId(String cattleresumeId) {
this.cattleresumeId = cattleresumeId; this.cattleresumeId = cattleresumeId;
} }
...@@ -277,6 +293,14 @@ public class BreedingRecordDetailEntity extends BaseObservable implements Parcel ...@@ -277,6 +293,14 @@ public class BreedingRecordDetailEntity extends BaseObservable implements Parcel
this.frozenSemenBatch = frozenSemenBatch; this.frozenSemenBatch = frozenSemenBatch;
} }
public String getOther() {
return other;
}
public void setOther(String other) {
this.other = other;
}
public String getMatingDate() { public String getMatingDate() {
return matingDate; return matingDate;
} }
...@@ -317,6 +341,22 @@ public class BreedingRecordDetailEntity extends BaseObservable implements Parcel ...@@ -317,6 +341,22 @@ public class BreedingRecordDetailEntity extends BaseObservable implements Parcel
this.pregnancy = pregnancy; this.pregnancy = pregnancy;
} }
public String getRaiseVarieties() {
return raiseVarieties;
}
public void setRaiseVarieties(String raiseVarieties) {
this.raiseVarieties = raiseVarieties;
}
public String getBreedingPlantId() {
return breedingPlantId;
}
public void setBreedingPlantId(String breedingPlantId) {
this.breedingPlantId = breedingPlantId;
}
public Long getDeptId() { public Long getDeptId() {
return deptId; return deptId;
} }
...@@ -395,13 +435,16 @@ public class BreedingRecordDetailEntity extends BaseObservable implements Parcel ...@@ -395,13 +435,16 @@ public class BreedingRecordDetailEntity extends BaseObservable implements Parcel
"unid=" + unid + "unid=" + unid +
", fUnid=" + fUnid + ", fUnid=" + fUnid +
", matingStyle='" + matingStyle + '\'' + ", matingStyle='" + matingStyle + '\'' +
", cattleresumeId=" + cattleresumeId + ", cattleresumeId='" + cattleresumeId + '\'' +
", frozenSemenBatch='" + frozenSemenBatch + '\'' + ", frozenSemenBatch='" + frozenSemenBatch + '\'' +
", other='" + other + '\'' +
", matingDate='" + matingDate + '\'' + ", matingDate='" + matingDate + '\'' +
", isReturn='" + isReturn + '\'' + ", isReturn='" + isReturn + '\'' +
", backLoveDate='" + backLoveDate + '\'' + ", backLoveDate='" + backLoveDate + '\'' +
", dueDate='" + dueDate + '\'' + ", dueDate='" + dueDate + '\'' +
", pregnancy='" + pregnancy + '\'' + ", pregnancy='" + pregnancy + '\'' +
", raiseVarieties='" + raiseVarieties + '\'' +
", breedingPlantId='" + breedingPlantId + '\'' +
", deptId=" + deptId + ", deptId=" + deptId +
", caId=" + caId + ", caId=" + caId +
", uploadStatus='" + uploadStatus + '\'' + ", uploadStatus='" + uploadStatus + '\'' +
......
...@@ -34,6 +34,8 @@ import com.phlx.anchorcollect_p.databinding.FragmentBreedingRecordBinding; ...@@ -34,6 +34,8 @@ import com.phlx.anchorcollect_p.databinding.FragmentBreedingRecordBinding;
import com.phlx.anchorcollect_p.entity.BreedingRecordDetailEntity; import com.phlx.anchorcollect_p.entity.BreedingRecordDetailEntity;
import com.phlx.anchorcollect_p.entity.DictEntity; import com.phlx.anchorcollect_p.entity.DictEntity;
import com.phlx.anchorcollect_p.entity.GenTableColumn; import com.phlx.anchorcollect_p.entity.GenTableColumn;
import com.phlx.anchorcollect_p.ui.fragment.search.SearchFrozenSemenFragment;
import com.phlx.anchorcollect_p.ui.fragment.search.interf.IOnSearchFrozenSemenClickListener;
import com.phlx.anchorcollect_p.ui.fragment.vm.BreedingRecordVM; import com.phlx.anchorcollect_p.ui.fragment.vm.BreedingRecordVM;
import com.phlx.anchorcollect_p.util.LoginInfoUtils; import com.phlx.anchorcollect_p.util.LoginInfoUtils;
import com.phlx.anchorcollect_p.util.ImagePicker; import com.phlx.anchorcollect_p.util.ImagePicker;
...@@ -41,8 +43,10 @@ import com.phlx.anchorcollect_p.util.StringUtil; ...@@ -41,8 +43,10 @@ import com.phlx.anchorcollect_p.util.StringUtil;
import com.phlx.anchorcollect_p.widget.SpaceItemDecoration; import com.phlx.anchorcollect_p.widget.SpaceItemDecoration;
import com.tbruyelle.rxpermissions2.RxPermissions; import com.tbruyelle.rxpermissions2.RxPermissions;
import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -50,7 +54,7 @@ import io.reactivex.functions.Consumer; ...@@ -50,7 +54,7 @@ import io.reactivex.functions.Consumer;
import me.goldze.mvvmhabit.base.BaseFragment; import me.goldze.mvvmhabit.base.BaseFragment;
import me.goldze.mvvmhabit.utils.ToastUtils; import me.goldze.mvvmhabit.utils.ToastUtils;
public class BreedingRecordFragment extends BaseFragment<FragmentBreedingRecordBinding, BreedingRecordVM> { public class BreedingRecordFragment extends BaseFragment<FragmentBreedingRecordBinding, BreedingRecordVM> implements IOnSearchFrozenSemenClickListener {
private TimePickerView pvTime; private TimePickerView pvTime;
...@@ -58,6 +62,8 @@ public class BreedingRecordFragment extends BaseFragment<FragmentBreedingRecordB ...@@ -58,6 +62,8 @@ public class BreedingRecordFragment extends BaseFragment<FragmentBreedingRecordB
private DataGridView mDataGridView; private DataGridView mDataGridView;
private SearchFrozenSemenFragment searchFrozenSemenFragment;
private static class SingletonClassInstance { private static class SingletonClassInstance {
private static final BreedingRecordFragment instance = new BreedingRecordFragment(); private static final BreedingRecordFragment instance = new BreedingRecordFragment();
} }
...@@ -96,6 +102,9 @@ public class BreedingRecordFragment extends BaseFragment<FragmentBreedingRecordB ...@@ -96,6 +102,9 @@ public class BreedingRecordFragment extends BaseFragment<FragmentBreedingRecordB
viewModel.initGen(); viewModel.initGen();
searchFrozenSemenFragment = SearchFrozenSemenFragment.newInstance();
searchFrozenSemenFragment.setIOnSearchVeterinaryClickListener(this);
// binding.rvCollect.addItemDecoration(new SpaceItemDecoration(10)); // binding.rvCollect.addItemDecoration(new SpaceItemDecoration(10));
binding.rvCollectDetail.addItemDecoration(new SpaceItemDecoration(10)); binding.rvCollectDetail.addItemDecoration(new SpaceItemDecoration(10));
...@@ -128,6 +137,9 @@ public class BreedingRecordFragment extends BaseFragment<FragmentBreedingRecordB ...@@ -128,6 +137,9 @@ public class BreedingRecordFragment extends BaseFragment<FragmentBreedingRecordB
case "radio": case "radio":
showSpinnerDialog(viewModel.currentParamEntity); showSpinnerDialog(viewModel.currentParamEntity);
break; break;
case "search":
showSearchDialog(viewModel.currentParamEntity);
break;
case "photo": case "photo":
if (viewModel.tag.get().equals("")) { if (viewModel.tag.get().equals("")) {
ToastUtils.showShort("请先输入可视耳标号"); ToastUtils.showShort("请先输入可视耳标号");
...@@ -232,6 +244,14 @@ public class BreedingRecordFragment extends BaseFragment<FragmentBreedingRecordB ...@@ -232,6 +244,14 @@ public class BreedingRecordFragment extends BaseFragment<FragmentBreedingRecordB
}).show(); }).show();
} }
//跳转搜索关键字页面
private void showSearchDialog(GenTableColumn uiParamEntity) {
assert getParentFragment() != null;
searchFrozenSemenFragment.showFragment(requireActivity().getSupportFragmentManager(), SearchFrozenSemenFragment.TAG);
}
//输入框 //输入框
private void showInputDialog(GenTableColumn uiParamEntity) { private void showInputDialog(GenTableColumn uiParamEntity) {
...@@ -333,6 +353,31 @@ public class BreedingRecordFragment extends BaseFragment<FragmentBreedingRecordB ...@@ -333,6 +353,31 @@ public class BreedingRecordFragment extends BaseFragment<FragmentBreedingRecordB
viewModel.currentParamEntity.setContent(dateFormat.format(date)); viewModel.currentParamEntity.setContent(dateFormat.format(date));
viewModel.currentParamEntity.setShowName(dateFormat.format(date)); viewModel.currentParamEntity.setShowName(dateFormat.format(date));
viewModel.currentParamEntity.notifyChange(); viewModel.currentParamEntity.notifyChange();
if("matingDate".equals(viewModel.currentParamEntity.getJavaField())) {
/**
计算预产期280天
*/
String str = "yyyy-MM-dd";
SimpleDateFormat format2 = new SimpleDateFormat(str);
Date dueDate = null;
try {
dueDate = format2.parse(dateFormat.format(date));
} catch (ParseException e) {
e.printStackTrace();
}
Calendar calendar = Calendar.getInstance();
calendar.setTime(dueDate);
calendar.add(Calendar.DATE, 280);
for (GenTableColumn gtc : Configs.cattlematingDetaill) {
if("dueDate".equals(gtc.getJavaField())){
gtc.setContent(format2.format(calendar.getTime()));
gtc.setShowName(format2.format(calendar.getTime()));
gtc.notifyChange();
break;
}
}
}
} }
}) })
.setTimeSelectChangeListener(new OnTimeSelectChangeListener() { .setTimeSelectChangeListener(new OnTimeSelectChangeListener() {
...@@ -471,4 +516,44 @@ public class BreedingRecordFragment extends BaseFragment<FragmentBreedingRecordB ...@@ -471,4 +516,44 @@ public class BreedingRecordFragment extends BaseFragment<FragmentBreedingRecordB
viewModel.rfid.set(""); viewModel.rfid.set("");
} }
} }
@Override
public void OnSelectedClick(DictEntity dictEntity) {
for (GenTableColumn gtc : Configs.cattlematingDetaill) {
switch (gtc.getJavaField()) {
case "frozenSemenBatch"://冻精信息
gtc.setContent(dictEntity.getDictValue());
gtc.setShowName(dictEntity.getDictLabel());
break;
case "cattleresumeId"://冻精注册号
if ("其它".equals(dictEntity.getDictLabel())) {
gtc.setContent("");
gtc.setShowName("");
} else {
String labelStr = "";
if(dictEntity.getDictLabel().lastIndexOf("/")>-1) {
labelStr = dictEntity.getDictLabel().substring(
dictEntity.getDictLabel().lastIndexOf("/") + 1, dictEntity.getDictLabel().length());
}else{
labelStr = dictEntity.getDictLabel();
}
gtc.setContent(labelStr);
gtc.setShowName(labelStr);
}
gtc.notifyChange();
break;
case "other"://其它
if ("其他".equals(dictEntity.getDictLabel())) {
} else {
gtc.setContent("");
gtc.setShowName("");
}
gtc.notifyChange();
break;
}
}
viewModel.currentParamEntity.notifyChange();
}
} }
...@@ -39,19 +39,20 @@ public class CollectGridItem extends ItemViewModel<BaseViewModel> { ...@@ -39,19 +39,20 @@ public class CollectGridItem extends ItemViewModel<BaseViewModel> {
private void initView() { private void initView() {
// switch (fragmentType) { switch (fragmentType) {
// case Configs.BASE_ARCHIVES: case Configs.BASE_ARCHIVES:
// case Configs.WEIGHTING_MANAGE: case Configs.WEIGHTING_MANAGE:
// case Configs.BREEDING_RECORD_DETAIL:
// if ("1".equals(entity.get().getIsEdit())) {
// titleGrayVisiable.set(View.GONE); if ("1".equals(entity.get().getIsEdit())) {
// titleBlueVisiable.set(View.VISIBLE); titleGrayVisiable.set(View.GONE);
// } else { titleBlueVisiable.set(View.VISIBLE);
// titleGrayVisiable.set(View.VISIBLE); } else {
// titleBlueVisiable.set(View.GONE); titleGrayVisiable.set(View.VISIBLE);
// } titleBlueVisiable.set(View.GONE);
// break; }
// default: break;
default:
if ("1".equals(entity.get().getIsInsert())) { if ("1".equals(entity.get().getIsInsert())) {
titleGrayVisiable.set(View.GONE); titleGrayVisiable.set(View.GONE);
titleBlueVisiable.set(View.VISIBLE); titleBlueVisiable.set(View.VISIBLE);
...@@ -59,8 +60,8 @@ public class CollectGridItem extends ItemViewModel<BaseViewModel> { ...@@ -59,8 +60,8 @@ public class CollectGridItem extends ItemViewModel<BaseViewModel> {
titleGrayVisiable.set(View.VISIBLE); titleGrayVisiable.set(View.VISIBLE);
titleBlueVisiable.set(View.GONE); titleBlueVisiable.set(View.GONE);
} }
// break; break;
// } }
} }
public BindingCommand onItemClickCommand = new BindingCommand(new BindingAction() { public BindingCommand onItemClickCommand = new BindingCommand(new BindingAction() {
......
package com.phlx.anchorcollect_p.ui.fragment.search;
import android.content.DialogInterface;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.DisplayMetrics;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.Window;
import android.view.WindowManager;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.FragmentManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.phlx.anchorcollect_p.R;
import com.phlx.anchorcollect_p.db.DbUtil;
import com.phlx.anchorcollect_p.db.gen.DictEntityDao;
import com.phlx.anchorcollect_p.db.interf.DbQueryCallBack;
import com.phlx.anchorcollect_p.entity.DictEntity;
import com.phlx.anchorcollect_p.ui.fragment.search.adapter.FrozenSemenAdapter;
import com.phlx.anchorcollect_p.ui.fragment.search.anim.CircularRevealAnim;
import com.phlx.anchorcollect_p.ui.fragment.search.interf.IOnFrozenSemenItemClickListener;
import com.phlx.anchorcollect_p.ui.fragment.search.interf.IOnSearchFrozenSemenClickListener;
import com.phlx.anchorcollect_p.util.KeyBoardUtils;
import org.greenrobot.greendao.query.QueryBuilder;
import java.util.ArrayList;
import java.util.List;
import me.goldze.mvvmhabit.utils.ToastUtils;
/**
* Created by Won on 2017/1/13.
*/
public class SearchFrozenSemenFragment extends DialogFragment implements DialogInterface.OnKeyListener,
ViewTreeObserver.OnPreDrawListener, CircularRevealAnim.AnimListener, IOnFrozenSemenItemClickListener
, View.OnClickListener {
public static final String TAG = "SearchFrozenSemenFragment";
private EditText etSearchKeyword;
private ImageView ivSearchSearch;
private View view;
//动画
private CircularRevealAnim mCircularRevealAnim;
//历史搜索记录
private ArrayList<DictEntity> queryFrozenSemens = new ArrayList<>();
private ArrayList<DictEntity> frozenSemens = new ArrayList<>();
//适配器
private FrozenSemenAdapter frozenSemenAdapter;
public static SearchFrozenSemenFragment newInstance() {
return new SearchFrozenSemenFragment();
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setStyle(DialogFragment.STYLE_NO_FRAME, R.style.DialogStyle);
}
@Override
public void onStart() {
super.onStart();
initDialog();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
view = inflater.inflate(R.layout.dialog_search, container, false);
init();//实例化
return view;
}
private void init() {
ImageView ivSearchBack = view.findViewById(R.id.iv_search_back);
etSearchKeyword = view.findViewById(R.id.et_search_keyword);
ivSearchSearch = view.findViewById(R.id.iv_search_search);
RecyclerView rvSearchVeterinary = view.findViewById(R.id.rv_search);
etSearchKeyword.setFocusableInTouchMode(true);
etSearchKeyword.requestFocus();
//实例化动画效果
mCircularRevealAnim = new CircularRevealAnim();
//监听动画
mCircularRevealAnim.setAnimListener(this);
getDialog().setOnKeyListener(this);//键盘按键监听
ivSearchSearch.getViewTreeObserver().addOnPreDrawListener(this);//绘制监听
//初始化recyclerView
rvSearchVeterinary.setLayoutManager(new LinearLayoutManager(getContext()));//list类型
frozenSemenAdapter = new FrozenSemenAdapter(getContext(), frozenSemens);
rvSearchVeterinary.setAdapter(frozenSemenAdapter);
frozenSemenAdapter.setOnItemClickListener(this);
//监听编辑框文字改变
etSearchKeyword.addTextChangedListener(new TextWatcherImpl());
//监听点击
ivSearchBack.setOnClickListener(this);
ivSearchSearch.setOnClickListener(this);
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
QueryBuilder<DictEntity> builder =
DbUtil.getInstance().getQueryBuilder(DictEntity.class)
.where(DictEntityDao.Properties.DictType.eq("zxgl_frozen_semen"));
DbUtil.getInstance().queryAsyncAll(DictEntity.class, builder, new DbQueryCallBack<DictEntity>() {
@Override
public void onSuccess(List<DictEntity> result) {
queryFrozenSemens.clear();
queryFrozenSemens.addAll(result);
setAllVeterinaries();
}
@Override
public void onFailed() {
}
});
}
/**
* 显示Fragment,防止多次打开导致崩溃
*/
public void showFragment(FragmentManager fragmentManager, String tag) {
if (!this.isAdded()) {
this.show(fragmentManager, tag);
}
}
@Override
public void onClick(View view) {
if (view.getId() == R.id.iv_search_back) {
hideAnim();
} else if (view.getId() == R.id.iv_search_search) {
search();
}
}
/**
* 初始化SearchFragment
*/
private void initDialog() {
Window window = getDialog().getWindow();
DisplayMetrics metrics = getResources().getDisplayMetrics();
int width = (int) (metrics.widthPixels * 0.98); //DialogSearch的宽
window.setLayout(width, WindowManager.LayoutParams.MATCH_PARENT);
window.setGravity(Gravity.TOP);
window.setWindowAnimations(R.style.DialogEmptyAnimation);//取消过渡动画 , 使DialogSearch的出现更加平滑
}
/**
* 监听键盘按键
*/
@Override
public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_UP) {
hideAnim();
} else if (keyCode == KeyEvent.KEYCODE_ENTER && event.getAction() == KeyEvent.ACTION_DOWN) {
search();
}
return false;
}
/**
* 监听搜索键绘制时
*/
@Override
public boolean onPreDraw() {
ivSearchSearch.getViewTreeObserver().removeOnPreDrawListener(this);
mCircularRevealAnim.show(ivSearchSearch, view);
return true;
}
/**
* 搜索框动画隐藏完毕时调用
*/
@Override
public void onHideAnimationEnd() {
etSearchKeyword.setText("");
dismiss();
}
/**
* 搜索框动画显示完毕时调用
*/
@Override
public void onShowAnimationEnd() {
if (isVisible()) {
KeyBoardUtils.openKeyboard(getContext(), etSearchKeyword);
}
}
@Override
public void onItemClick(DictEntity dictEntity) {
onSearchFrozenSemenClickListener.OnSelectedClick(dictEntity);
hideAnim();
}
/**
* 监听编辑框文字改变
*/
private class TextWatcherImpl implements TextWatcher {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void afterTextChanged(Editable editable) {
String keyword = editable.toString();
if (TextUtils.isEmpty(keyword.trim())) {
setAllVeterinaries();
} else {
setKeyWordVeterinaries(editable.toString());
}
}
}
private void hideAnim() {
KeyBoardUtils.closeKeyboard(getContext(), etSearchKeyword);
mCircularRevealAnim.hide(ivSearchSearch, view);
}
private void search() {
String searchKey = etSearchKeyword.getText().toString();
if (TextUtils.isEmpty(searchKey.trim())) {
Toast.makeText(getContext(), "请输入关键字", Toast.LENGTH_SHORT).show();
} else {
QueryBuilder<DictEntity> builder =
DbUtil.getInstance().getQueryBuilder(DictEntity.class)
.where(DictEntityDao.Properties.DictLabel.eq(searchKey), DictEntityDao.Properties.DictType.eq("zxgl_frozen_semen"));
List<DictEntity> veterinaries = DbUtil.getInstance().queryAll(DictEntity.class, builder);
if (veterinaries == null || veterinaries.size() == 0) {
ToastUtils.showShort("未找到符合 " + searchKey + " 的搜索结果");
} else {
onSearchFrozenSemenClickListener.OnSelectedClick(veterinaries.get(0));
hideAnim();
}
}
}
private void setAllVeterinaries() {
frozenSemens.clear();
frozenSemens.addAll(queryFrozenSemens);
frozenSemenAdapter.notifyDataSetChanged();
}
private void setKeyWordVeterinaries(String keyword) {
frozenSemens.clear();
QueryBuilder<DictEntity> builder =
DbUtil.getInstance().getQueryBuilder(DictEntity.class)
.where(DictEntityDao.Properties.DictLabel.like("%" + keyword + "%"));
DbUtil.getInstance().queryAsyncAll(DictEntity.class, builder, new DbQueryCallBack<DictEntity>() {
@Override
public void onSuccess(List<DictEntity> result) {
if (result != null && result.size() > 0) {
frozenSemens.addAll(result);
frozenSemenAdapter.notifyDataSetChanged();
} else {
frozenSemens.clear();
frozenSemenAdapter.notifyDataSetChanged();
}
}
@Override
public void onFailed() {
}
});
}
private IOnSearchFrozenSemenClickListener onSearchFrozenSemenClickListener;
public void setIOnSearchVeterinaryClickListener(IOnSearchFrozenSemenClickListener onSearchFrozenSemenClickListener) {
this.onSearchFrozenSemenClickListener = onSearchFrozenSemenClickListener;
}
}
package com.phlx.anchorcollect_p.ui.fragment.search.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import com.phlx.anchorcollect_p.R;
import com.phlx.anchorcollect_p.entity.DictEntity;
import com.phlx.anchorcollect_p.ui.fragment.search.interf.IOnFrozenSemenItemClickListener;
import java.util.ArrayList;
public class FrozenSemenAdapter extends RecyclerView.Adapter<FrozenSemenAdapter.MyViewHolder> implements View.OnClickListener{
private Context context;
private ArrayList<DictEntity> frozenSemens = new ArrayList<>();
public FrozenSemenAdapter(Context context, ArrayList<DictEntity> list) {
this.context = context;
this.frozenSemens = list;
}
@Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(context).
inflate(R.layout.item_search, parent, false);
MyViewHolder holder = new MyViewHolder(view);
view.setOnClickListener(this);
return holder;
}
@Override
public void onBindViewHolder(final MyViewHolder holder, final int position) {
holder.name.setText(frozenSemens.get(position).getDictLabel());
// holder.phone.setText(frozenSemens.get(position).getVeterinaryPhone());
holder.itemView.setTag(position);
}
@Override
public int getItemCount() {
return frozenSemens.size();
}
@Override
public void onClick(View v) {
if (onFrozenSemenItemClickListener != null && frozenSemens.size() > 0) {
onFrozenSemenItemClickListener.onItemClick(frozenSemens.get((Integer) v.getTag()));
}
}
class MyViewHolder extends RecyclerView.ViewHolder {
TextView name;
// TextView phone;
public MyViewHolder(View view) {
super(view);
name = (TextView) view.findViewById(R.id.name_tv);
// phone = (TextView) view.findViewById(R.id.phone_tv);
}
}
private IOnFrozenSemenItemClickListener onFrozenSemenItemClickListener;
public void setOnItemClickListener(IOnFrozenSemenItemClickListener onFrozenSemenItemClickListener) {
this.onFrozenSemenItemClickListener = onFrozenSemenItemClickListener;
}
}
package com.phlx.anchorcollect_p.ui.fragment.search.anim;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.annotation.SuppressLint;
import android.view.View;
import android.view.ViewAnimationUtils;
import android.view.animation.DecelerateInterpolator;
public class CircularRevealAnim {
public static final long DURATION = 200;
private AnimListener mListener;
public interface AnimListener {
void onHideAnimationEnd();
void onShowAnimationEnd();
}
@SuppressLint("NewApi")
private void actionOtherVisible(final boolean isShow, final View triggerView, final View animView) {
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP) {
if (isShow) {
animView.setVisibility(View.VISIBLE);
if (mListener != null) mListener.onShowAnimationEnd();
} else {
animView.setVisibility(View.GONE);
if (mListener != null) mListener.onHideAnimationEnd();
}
return;
}
/**
* 计算 triggerView 的中心位置
*/
int[] tvLocation = new int[2];
triggerView.getLocationInWindow(tvLocation);
int tvX = tvLocation[0] + triggerView.getWidth() / 2;
int tvY = tvLocation[1] + triggerView.getHeight() / 2;
/**
* 计算 animView 的中心位置
*/
int[] avLocation = new int[2];
animView.getLocationInWindow(avLocation);
int avX = avLocation[0] + animView.getWidth() / 2;
int avY = avLocation[1] + animView.getHeight() / 2;
int rippleW = tvX < avX ? animView.getWidth() - tvX : tvX - avLocation[0];
int rippleH = tvY < avY ? animView.getHeight() - tvY : tvY - avLocation[1];
float maxRadius = (float) Math.sqrt(rippleW * rippleW + rippleH * rippleH);
float startRadius;
float endRadius;
if (isShow) {
startRadius = 0;
endRadius = maxRadius;
} else {
startRadius = maxRadius;
endRadius = 0;
}
Animator anim = ViewAnimationUtils.createCircularReveal(animView, tvX, tvY, startRadius, endRadius);
animView.setVisibility(View.VISIBLE);
anim.setDuration(DURATION);
anim.setInterpolator(new DecelerateInterpolator());
anim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
if (isShow) {
animView.setVisibility(View.VISIBLE);
if (mListener != null) mListener.onShowAnimationEnd();
} else {
animView.setVisibility(View.GONE);
if (mListener != null) mListener.onHideAnimationEnd();
}
}
});
anim.start();
}
public void show(View triggerView, View showView) {
actionOtherVisible(true, triggerView, showView);
}
public void hide(View triggerView, View hideView) {
actionOtherVisible(false, triggerView, hideView);
}
public void setAnimListener(AnimListener listener) {
mListener = listener;
}
}
\ No newline at end of file
package com.phlx.anchorcollect_p.ui.fragment.search.interf;
import com.phlx.anchorcollect_p.entity.DictEntity;
/**
* Created by Won on 2016/4/22.
*/
public interface IOnFrozenSemenItemClickListener {
void onItemClick(DictEntity dictEntity);
}
package com.phlx.anchorcollect_p.ui.fragment.search.interf;
import com.phlx.anchorcollect_p.entity.DictEntity;
/**
* Created by Won on 2017/1/13.
*/
public interface IOnSearchFrozenSemenClickListener {
void OnSelectedClick(DictEntity dictEntity);
}
...@@ -583,18 +583,18 @@ public class BreedingRecordVM extends BaseViewModel<Repository> { ...@@ -583,18 +583,18 @@ public class BreedingRecordVM extends BaseViewModel<Repository> {
/** /**
计算预产期280天 计算预产期280天
*/ */
String str = "yyyy-MM-dd"; // String str = "yyyy-MM-dd";
SimpleDateFormat format2 = new SimpleDateFormat(str); // SimpleDateFormat format2 = new SimpleDateFormat(str);
Date date = null; // Date date = null;
try { // try {
date = format2.parse(breedingRecordDetailEntity.getMatingDate()); // date = format2.parse(breedingRecordDetailEntity.getMatingDate());
} catch (ParseException e) { // } catch (ParseException e) {
e.printStackTrace(); // e.printStackTrace();
} // }
Calendar calendar = Calendar.getInstance(); // Calendar calendar = Calendar.getInstance();
calendar.setTime(date); // calendar.setTime(date);
calendar.add(Calendar.DATE, 280); // calendar.add(Calendar.DATE, 280);
breedingRecordDetailEntity.setDueDate(format2.format(calendar.getTime())); // breedingRecordDetailEntity.setDueDate(format2.format(calendar.getTime()));
detailUploadData = new ArrayList<>(); detailUploadData = new ArrayList<>();
detailUploadData.add(breedingRecordDetailEntity); detailUploadData.add(breedingRecordDetailEntity);
......
...@@ -81,8 +81,8 @@ public class LoginVM extends BaseViewModel<Repository> { ...@@ -81,8 +81,8 @@ public class LoginVM extends BaseViewModel<Repository> {
userName.set(model.getUserName()); userName.set(model.getUserName());
password.set(model.getPassword()); password.set(model.getPassword());
userName.set("13664793087"); // userName.set("13664793087");
password.set("Abgq3087@"); // password.set("Abgq3087@");
// userName.set("15047917803"); // userName.set("15047917803");
// password.set("Tpsq7803*"); // password.set("Tpsq7803*");
...@@ -121,7 +121,7 @@ public class LoginVM extends BaseViewModel<Repository> { ...@@ -121,7 +121,7 @@ public class LoginVM extends BaseViewModel<Repository> {
public BindingCommand loginOnClickCommand = new BindingCommand(new BindingAction() { public BindingCommand loginOnClickCommand = new BindingCommand(new BindingAction() {
@Override @Override
public void call() { public void call() {
if(Integer.parseInt(DateUtils.getYear())<2020){ if (Integer.parseInt(DateUtils.getYear()) < 2020) {
dateEvent.call(); dateEvent.call();
return; return;
} }
...@@ -176,8 +176,8 @@ public class LoginVM extends BaseViewModel<Repository> { ...@@ -176,8 +176,8 @@ public class LoginVM extends BaseViewModel<Repository> {
SPUtils.getInstance().put(Configs.SP_DEPT_NAME, response.getData().getUser().getDept().getDeptName()); SPUtils.getInstance().put(Configs.SP_DEPT_NAME, response.getData().getUser().getDept().getDeptName());
//意见反馈存版本号,如果没有保存或者有变化 提醒数量清零 //意见反馈存版本号,如果没有保存或者有变化 提醒数量清零
if(StringUtils.isEmpty(SPUtils.getInstance().getString(Configs.SP_VERSION_NAME)) if (StringUtils.isEmpty(SPUtils.getInstance().getString(Configs.SP_VERSION_NAME))
|| !ApkUtil.getVersionName(getApplication()).equals(SPUtils.getInstance().getString(Configs.SP_VERSION_NAME))){ || !ApkUtil.getVersionName(getApplication()).equals(SPUtils.getInstance().getString(Configs.SP_VERSION_NAME))) {
SPUtils.getInstance().put(Configs.SP_FEEDBACK_COUNT, 0); SPUtils.getInstance().put(Configs.SP_FEEDBACK_COUNT, 0);
} }
SPUtils.getInstance().put(Configs.SP_VERSION_NAME, ApkUtil.getVersionName(getApplication())); SPUtils.getInstance().put(Configs.SP_VERSION_NAME, ApkUtil.getVersionName(getApplication()));
......
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/shape_corner_white"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="6dp">
<ImageView
android:id="@+id/iv_search_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="6dp"
android:src="@drawable/ic_back_24dp" />
<EditText
android:id="@+id/et_search_keyword"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@null"
android:hint="搜索关键字"
android:imeOptions="actionSearch"
android:padding="6dp"
android:singleLine="true"
android:textSize="14sp" />
<!-- android:focusable="true"-->
<!-- android:focusableInTouchMode="true"-->
<ImageView
android:id="@+id/iv_search_search"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="6dp"
android:src="@drawable/ic_search_bg_24dp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="@color/line_bg" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_search"
android:layout_width="match_parent"
android:layout_margin="@dimen/dp_15"
android:layout_height="0dp"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_40">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/name_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/sp_13"
android:layout_marginStart="@dimen/dp_20"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/phone_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/sp_13"
android:layout_marginEnd="@dimen/dp_20"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment