diff --git a/build.gradle b/build.gradle index 7ade5f124..397e7ada2 100644 --- a/build.gradle +++ b/build.gradle @@ -38,7 +38,7 @@ task checkAll(type: GradleBuild) { } task checkCode(type: GradleBuild) { - tasks = ['pmd', 'checkstyle', 'lintDebug', 'spotbugs'] + tasks = ['pmd', 'lintDebug'] } task checkTests(type: GradleBuild) { diff --git a/collect_app/schemas/org.fieldsight.naxa.common.FieldSightDatabase/21.json b/collect_app/schemas/org.fieldsight.naxa.common.FieldSightDatabase/21.json index a3080ba88..b494dd9ac 100644 --- a/collect_app/schemas/org.fieldsight.naxa.common.FieldSightDatabase/21.json +++ b/collect_app/schemas/org.fieldsight.naxa.common.FieldSightDatabase/21.json @@ -2,11 +2,11 @@ "formatVersion": 1, "database": { "version": 21, - "identityHash": "10c529a9b424519f55eafba149787072", + "identityHash": "8d85328bc10a78d4553c187be40e5a83", "entities": [ { "tableName": "sites", - "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `latitude` TEXT, `longitude` TEXT, `identifier` TEXT, `name` TEXT, `typeId` TEXT, `typeLabel` TEXT, `phone` TEXT, `address` TEXT, `publicDesc` TEXT, `additionalDesc` TEXT, `logo` TEXT, `isActive` INTEGER, `location` TEXT, `isSurvey` INTEGER, `dateCreated` TEXT, `project` TEXT, `isSiteVerified` INTEGER NOT NULL, `siteTypeError` TEXT, `metaAttributes` TEXT, `siteDocuments` TEXT, `regionId` TEXT, `site` TEXT, `generalFormDeployedFrom` TEXT, `stagedFormDeployedFrom` TEXT, `scheduleFormDeployedForm` TEXT, PRIMARY KEY(`id`))", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `latitude` TEXT, `longitude` TEXT, `identifier` TEXT, `name` TEXT, `typeId` TEXT, `typeLabel` TEXT, `phone` TEXT, `address` TEXT, `publicDesc` TEXT, `additionalDesc` TEXT, `logo` TEXT, `isActive` INTEGER, `location` TEXT, `isSurvey` INTEGER, `dateCreated` TEXT, `PROJECT` TEXT, `isSiteVerified` INTEGER NOT NULL, `siteTypeError` TEXT, `metaAttributes` TEXT, `siteDocuments` TEXT, `regionId` TEXT, `site` TEXT, `generalFormDeployedFrom` TEXT, `stagedFormDeployedFrom` TEXT, `scheduleFormDeployedForm` TEXT, PRIMARY KEY(`id`))", "fields": [ { "fieldPath": "id", @@ -106,7 +106,7 @@ }, { "fieldPath": "project", - "columnName": "project", + "columnName": "PROJECT", "affinity": "TEXT", "notNull": false }, @@ -175,8 +175,8 @@ "foreignKeys": [] }, { - "tableName": "project", - "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `name` TEXT, `description` TEXT, `address` TEXT, `lat` TEXT, `lon` TEXT, `url` TEXT, `siteClusters` TEXT, `organizationName` TEXT, `organizationlogourl` TEXT, `hasClusteredSites` INTEGER, `typeId` INTEGER, `typeLabel` TEXT, `phone` TEXT, `isSyncedWithRemote` INTEGER NOT NULL, `terms_and_labels` TEXT, `regionList` TEXT, `siteMetaAttributes` TEXT, PRIMARY KEY(`id`))", + "tableName": "PROJECT", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `name` TEXT, `description` TEXT, `address` TEXT, `lat` TEXT, `lon` TEXT, `url` TEXT, `siteClusters` TEXT, `organizationName` TEXT, `organizationlogourl` TEXT, `hasClusteredSites` INTEGER, `typeId` INTEGER, `typeLabel` TEXT, `phone` TEXT, `isSyncedWithRemote` INTEGER NOT NULL, `termsAndLabels` TEXT, `regionList` TEXT, `siteMetaAttributes` TEXT, PRIMARY KEY(`id`))", "fields": [ { "fieldPath": "id", @@ -269,8 +269,8 @@ "notNull": true }, { - "fieldPath": "terms_and_labels", - "columnName": "terms_and_labels", + "fieldPath": "termsAndLabels", + "columnName": "termsAndLabels", "affinity": "TEXT", "notNull": false }, @@ -893,7 +893,7 @@ }, { "tableName": "FieldSightNotification", - "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `notificationType` TEXT, `notifiedDate` TEXT, `notifiedTime` TEXT, `idString` TEXT, `fsFormId` TEXT, `fsFormIdProject` TEXT, `formName` TEXT, `siteId` TEXT, `siteName` TEXT, `projectId` TEXT, `projectName` TEXT, `formStatus` TEXT, `role` TEXT, `isFormDeployed` TEXT, `details_url` TEXT, `comment` TEXT, `formType` TEXT, `isRead` INTEGER NOT NULL, `formSubmissionId` TEXT, `formVersion` TEXT, `siteIdentifier` TEXT, `receivedDateTime` TEXT, `isDeployedFromSite` INTEGER NOT NULL, `receivedDateTimeInMillis` INTEGER NOT NULL, `schedule_forms_count` TEXT)", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `notificationType` TEXT, `notifiedDate` TEXT, `notifiedTime` TEXT, `idString` TEXT, `fsFormId` TEXT, `fsFormIdProject` TEXT, `formName` TEXT, `siteId` TEXT, `siteName` TEXT, `projectId` TEXT, `projectName` TEXT, `formStatus` TEXT, `role` TEXT, `isFormDeployed` TEXT, `detailsUrl` TEXT, `comment` TEXT, `formType` TEXT, `isRead` INTEGER NOT NULL, `formSubmissionId` TEXT, `formVersion` TEXT, `siteIdentifier` TEXT, `receivedDateTime` TEXT, `isDeployedFromSite` INTEGER NOT NULL, `receivedDateTimeInMillis` INTEGER NOT NULL, `schedule_forms_count` TEXT)", "fields": [ { "fieldPath": "id", @@ -986,8 +986,8 @@ "notNull": false }, { - "fieldPath": "details_url", - "columnName": "details_url", + "fieldPath": "detailsUrl", + "columnName": "detailsUrl", "affinity": "TEXT", "notNull": false }, @@ -1122,7 +1122,7 @@ }, { "tableName": "contacts", - "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `username` TEXT, `email` TEXT, `address` TEXT, `gender` TEXT, `phone` TEXT, `skype` TEXT, `twitter` TEXT, `tango` TEXT, `hike` TEXT, `qq` TEXT, `google_talk` TEXT, `profilePicture` TEXT, `viber` TEXT, `whatsapp` TEXT, `wechat` TEXT, `full_name` TEXT, `primary_number` TEXT, `secondary_number` TEXT, `office_number` TEXT, `roleString` TEXT)", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `username` TEXT, `email` TEXT, `address` TEXT, `gender` TEXT, `phone` TEXT, `skype` TEXT, `twitter` TEXT, `tango` TEXT, `hike` TEXT, `qq` TEXT, `googleTalk` TEXT, `profilePicture` TEXT, `viber` TEXT, `whatsapp` TEXT, `wechat` TEXT, `fullName` TEXT, `primaryNumber` TEXT, `secondaryNumber` TEXT, `officeNumber` TEXT, `roleString` TEXT)", "fields": [ { "fieldPath": "id", @@ -1191,8 +1191,8 @@ "notNull": false }, { - "fieldPath": "google_talk", - "columnName": "google_talk", + "fieldPath": "googleTalk", + "columnName": "googleTalk", "affinity": "TEXT", "notNull": false }, @@ -1221,26 +1221,26 @@ "notNull": false }, { - "fieldPath": "full_name", - "columnName": "full_name", + "fieldPath": "fullName", + "columnName": "fullName", "affinity": "TEXT", "notNull": false }, { - "fieldPath": "primary_number", - "columnName": "primary_number", + "fieldPath": "primaryNumber", + "columnName": "primaryNumber", "affinity": "TEXT", "notNull": false }, { - "fieldPath": "secondary_number", - "columnName": "secondary_number", + "fieldPath": "secondaryNumber", + "columnName": "secondaryNumber", "affinity": "TEXT", "notNull": false }, { - "fieldPath": "office_number", - "columnName": "office_number", + "fieldPath": "officeNumber", + "columnName": "officeNumber", "affinity": "TEXT", "notNull": false }, @@ -1357,7 +1357,7 @@ "notNull": true }, { - "fieldPath": "created_date", + "fieldPath": "createdDate", "columnName": "created_date", "affinity": "INTEGER", "notNull": true @@ -1527,7 +1527,7 @@ }, { "tableName": "fieldsight_formv3", - "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `site` TEXT, `project` TEXT, `site_project_id` TEXT, `type` TEXT, `em` TEXT, `description` TEXT, `settings` TEXT, `formDetails` TEXT, `metaAttributes` TEXT, PRIMARY KEY(`id`))", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `site` TEXT, `PROJECT` TEXT, `site_project_id` TEXT, `type` TEXT, `em` TEXT, `description` TEXT, `settings` TEXT, `formDetails` TEXT, `metaAttributes` TEXT, PRIMARY KEY(`id`))", "fields": [ { "fieldPath": "id", @@ -1543,12 +1543,12 @@ }, { "fieldPath": "project", - "columnName": "project", + "columnName": "PROJECT", "affinity": "TEXT", "notNull": false }, { - "fieldPath": "site_project_id", + "fieldPath": "siteProjectId", "columnName": "site_project_id", "affinity": "TEXT", "notNull": false @@ -1603,7 +1603,7 @@ "views": [], "setupQueries": [ "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)", - "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '10c529a9b424519f55eafba149787072')" + "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '8d85328bc10a78d4553c187be40e5a83')" ] } } \ No newline at end of file diff --git a/collect_app/src/main/AndroidManifest.xml b/collect_app/src/main/AndroidManifest.xml index d365341dc..ac58f84f5 100644 --- a/collect_app/src/main/AndroidManifest.xml +++ b/collect_app/src/main/AndroidManifest.xml @@ -120,9 +120,9 @@ <activity android:name="org.fieldsight.naxa.migrate.MigrateFieldSightActivity" /> <activity android:name="org.fieldsight.naxa.educational.EducationalMaterialActivity" /> <activity android:name="org.fieldsight.naxa.project.AppUpdateActivity" /> - <activity android:name="org.fieldsight.naxa.educational.EduMat_ViewTextTitleDetailsActivity" /> + <activity android:name="org.fieldsight.naxa.educational.EduMatViewTextTitleDetailsActivity" /> <activity android:name="org.fieldsight.naxa.educational.EduMatImageDetailsActivity" /> - <activity android:name="org.fieldsight.naxa.educational.EduMat_ViewVideoDetailsActivity" /> + <activity android:name="org.fieldsight.naxa.educational.EduMatViewVideoDetailsActivity" /> <activity android:name="org.fieldsight.naxa.FSInstanceUploaderListActivity" /> <activity android:name="org.fieldsight.naxa.FSInstanceChooserList" /> <activity android:name="org.fieldsight.naxa.sync.ContentDownloadActivity" /> diff --git a/collect_app/src/main/java/org/fieldsight/naxa/common/FilterDialogAdapter.java b/collect_app/src/main/java/org/fieldsight/naxa/common/FilterDialogAdapter.java index 79565ecb0..ee5efb6ae 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/common/FilterDialogAdapter.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/common/FilterDialogAdapter.java @@ -113,8 +113,9 @@ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int positi @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { Pair tappedIdLabelPair = filterOption.getOptions().get(position); - if (tappedIdLabelPair != null) + if (tappedIdLabelPair != null){ filterOption.setSelection(tappedIdLabelPair); + } } diff --git a/collect_app/src/main/java/org/fieldsight/naxa/common/utilities/ZipUtils.java b/collect_app/src/main/java/org/fieldsight/naxa/common/utilities/ZipUtils.java index 2fbd09fb0..aaa7caf54 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/common/utilities/ZipUtils.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/common/utilities/ZipUtils.java @@ -160,7 +160,6 @@ public String getLastPathComponent(String filePath) { if (segments.length == 0) { return ""; } - String lastPathComponent = segments[segments.length - 1]; - return lastPathComponent; + return segments[segments.length - 1]; } } diff --git a/collect_app/src/main/java/org/fieldsight/naxa/common/view/BaseRecyclerViewAdapter.java b/collect_app/src/main/java/org/fieldsight/naxa/common/view/BaseRecyclerViewAdapter.java index 0eac164da..9acc4adb2 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/common/view/BaseRecyclerViewAdapter.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/common/view/BaseRecyclerViewAdapter.java @@ -12,7 +12,7 @@ import timber.log.Timber; -public abstract class BaseRecyclerViewAdapter<L, VH extends RecyclerView.ViewHolder> extends RecyclerView.Adapter<VH> { +public abstract class BaseRecyclerViewAdapter<L, H extends RecyclerView.ViewHolder> extends RecyclerView.Adapter<H> { private final List<L> l; private final int layout; @@ -24,13 +24,13 @@ protected BaseRecyclerViewAdapter(List<L> l, int layout) { @NonNull @Override - public VH onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + public H onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()).inflate(layout, parent, false); return attachViewHolder(view); } @Override - public void onBindViewHolder(@NonNull VH holder, int position) { + public void onBindViewHolder(@NonNull H holder, int position) { viewBinded(holder, l.get(position)); } @@ -43,9 +43,9 @@ public int getItemCount() { return l.size(); } - public abstract void viewBinded(VH vh, L l); + public abstract void viewBinded(H vh, L l); - public abstract VH attachViewHolder(View view); + public abstract H attachViewHolder(View view); } \ No newline at end of file diff --git a/collect_app/src/main/java/org/fieldsight/naxa/contact/ContactAdapter.java b/collect_app/src/main/java/org/fieldsight/naxa/contact/ContactAdapter.java index f0917a5b4..3ef9b3bd5 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/contact/ContactAdapter.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/contact/ContactAdapter.java @@ -73,7 +73,7 @@ public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { @Override public void onBindViewHolder( final MyViewHolder holder, int position) { final FieldSightContactModel contact = contactList.get(position); - holder.tvFullName.setText(contact.getFull_name()); + holder.tvFullName.setText(contact.getFullName()); holder.tvUserName.setText(contact.getEmail()); /* //open tvSkype @@ -137,11 +137,11 @@ public void onClick(View v) { } }); */ - String Img_Thumb_Url = contact.getProfilePicture(); + String profilePicture = contact.getProfilePicture(); - if (Img_Thumb_Url != null) { + if (profilePicture != null) { GlideApp.with(context) - .load(Img_Thumb_Url) + .load(profilePicture) .circleCrop() .thumbnail(0.5f) .into(holder.ivProfilePicture); diff --git a/collect_app/src/main/java/org/fieldsight/naxa/contact/ContactDetailsBottomSheetFragment.java b/collect_app/src/main/java/org/fieldsight/naxa/contact/ContactDetailsBottomSheetFragment.java index 9cf229a65..616cd8ee8 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/contact/ContactDetailsBottomSheetFragment.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/contact/ContactDetailsBottomSheetFragment.java @@ -52,7 +52,7 @@ private void ContactDetailToViews() { .into(profilePicture); } - BindAndSetOrHide(fullname, R.id.tv_contactdetail_fullname, contactDetail.getFull_name()); + BindAndSetOrHide(fullname, R.id.tv_contactdetail_fullname, contactDetail.getFullName()); BindAndSetOrHide(username, R.id.tv_contactdetail_username, contactDetail.getUsername()); @@ -74,7 +74,7 @@ private void ContactDetailToViews() { BindAndSetOrHide(qq, R.id.tv_contactdetail_qq, contactDetail.getQq(), R.id.iv_qq_icon); - BindAndSetOrHide(googletalk, R.id.tv_contactdetail_googletalk, contactDetail.getGoogle_talk(), R.id.iv_googletalk_icon); + BindAndSetOrHide(googletalk, R.id.tv_contactdetail_googletalk, contactDetail.getGoogleTalk(), R.id.iv_googletalk_icon); BindAndSetOrHide(viber, R.id.tv_contactdetail_viber, contactDetail.getViber(), R.id.iv_viber_icon); diff --git a/collect_app/src/main/java/org/fieldsight/naxa/contact/ContactLocalSource.java b/collect_app/src/main/java/org/fieldsight/naxa/contact/ContactLocalSource.java index 7df63d339..83b5bfcee 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/contact/ContactLocalSource.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/contact/ContactLocalSource.java @@ -13,7 +13,7 @@ public class ContactLocalSource implements BaseLocalDataSource<FieldSightContactModel> { - private static ContactLocalSource INSTANCE; + private static ContactLocalSource contactLocalSource; private final ContacstDao dao; @@ -24,10 +24,10 @@ private ContactLocalSource() { public synchronized static ContactLocalSource getInstance() { - if (INSTANCE == null) { - INSTANCE = new ContactLocalSource(); + if (contactLocalSource == null) { + contactLocalSource = new ContactLocalSource(); } - return INSTANCE; + return contactLocalSource; } diff --git a/collect_app/src/main/java/org/fieldsight/naxa/contact/FieldSightContactModel.java b/collect_app/src/main/java/org/fieldsight/naxa/contact/FieldSightContactModel.java index 92afec9d9..8a3159beb 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/contact/FieldSightContactModel.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/contact/FieldSightContactModel.java @@ -39,7 +39,7 @@ public class FieldSightContactModel { @SerializedName("qq") private String qq; @SerializedName("google_talk") - private String google_talk; + private String googleTalk; @SerializedName("profile_picture") private String profilePicture; @@ -50,7 +50,7 @@ public class FieldSightContactModel { @SerializedName("wechat") private String wechat; @SerializedName("full_name") - private String full_name; + private String fullName; @Ignore @TypeConverters(RoleModelTypeConverter.class) @@ -58,11 +58,11 @@ public class FieldSightContactModel { private ArrayList<RoleModel> role; @SerializedName("primary_number") - private String primary_number; + private String primaryNumber; @SerializedName("secondary_number") - private String secondary_number; + private String secondaryNumber; @SerializedName("office_number") - private String office_number; + private String officeNumber; private String roleString; @@ -124,12 +124,12 @@ public void setSkype(String skype) { this.skype = skype; } - public String getFull_name() { - return full_name; + public String getFullName() { + return fullName; } - public void setFull_name(String full_name) { - this.full_name = full_name; + public void setFullName(String fullName) { + this.fullName = fullName; } public String getTwitter() { @@ -164,12 +164,12 @@ public void setQq(String qq) { this.qq = qq; } - public String getGoogle_talk() { - return google_talk; + public String getGoogleTalk() { + return googleTalk; } - public void setGoogle_talk(String google_talk) { - this.google_talk = google_talk; + public void setGoogleTalk(String googleTalk) { + this.googleTalk = googleTalk; } public String getViber() { @@ -204,28 +204,28 @@ public void setRole(ArrayList<RoleModel> role) { this.role = role; } - public String getPrimary_number() { - return primary_number; + public String getPrimaryNumber() { + return primaryNumber; } - public void setPrimary_number(String primary_number) { - this.primary_number = primary_number; + public void setPrimaryNumber(String primaryNumber) { + this.primaryNumber = primaryNumber; } - public String getSecondary_number() { - return secondary_number; + public String getSecondaryNumber() { + return secondaryNumber; } - public void setSecondary_number(String secondary_number) { - this.secondary_number = secondary_number; + public void setSecondaryNumber(String secondaryNumber) { + this.secondaryNumber = secondaryNumber; } - public String getOffice_number() { - return office_number; + public String getOfficeNumber() { + return officeNumber; } - public void setOffice_number(String office_number) { - this.office_number = office_number; + public void setOfficeNumber(String officeNumber) { + this.officeNumber = officeNumber; } public String getProfilePicture() { diff --git a/collect_app/src/main/java/org/fieldsight/naxa/data/FieldSightNotification.java b/collect_app/src/main/java/org/fieldsight/naxa/data/FieldSightNotification.java index f2fe24e1e..4c803b086 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/data/FieldSightNotification.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/data/FieldSightNotification.java @@ -32,7 +32,7 @@ public class FieldSightNotification implements Parcelable { private String formStatus; private String role; private String isFormDeployed; - private String details_url; + private String detailsUrl; private String comment; private String formType; private boolean isRead; @@ -55,7 +55,7 @@ public FieldSightNotification() { @Ignore public FieldSightNotification(@NonNull int id, String notificationType, String notifiedDate, String notifiedTime, String idString, String fsFormId, String fsFormIdProject, String formName, String siteId, String siteName, String projectId, - String projectName, String formStatus, String role, String isFormDeployed, String details_url, String comment, + String projectName, String formStatus, String role, String isFormDeployed, String detailsUrl, String comment, String formType, boolean isRead, String formSubmissionId, String formVersion, String siteIdentifier, boolean isDeployedFromSite, String scheduleFormsCount,String receivedDateTime, long receivedDateTimeInMillis) { this.id = id; this.notificationType = notificationType; @@ -72,7 +72,7 @@ public FieldSightNotification(@NonNull int id, String notificationType, String n this.formStatus = formStatus; this.role = role; this.isFormDeployed = isFormDeployed; - this.details_url = details_url; + this.detailsUrl = detailsUrl; this.comment = comment; this.formType = formType; this.isRead = isRead; @@ -258,12 +258,12 @@ public void setIsFormDeployed(String isFormDeployed) { this.isFormDeployed = isFormDeployed; } - public String getDetails_url() { - return details_url; + public String getDetailsUrl() { + return detailsUrl; } - public void setDetails_url(String details_url) { - this.details_url = details_url; + public void setDetailsUrl(String detailsUrl) { + this.detailsUrl = detailsUrl; } public String getComment() { @@ -308,7 +308,7 @@ public void writeToParcel(Parcel dest, int flags) { dest.writeString(this.formStatus); dest.writeString(this.role); dest.writeString(this.isFormDeployed); - dest.writeString(this.details_url); + dest.writeString(this.detailsUrl); dest.writeString(this.comment); dest.writeString(this.formType); dest.writeString(this.formSubmissionId); @@ -337,7 +337,7 @@ protected FieldSightNotification(Parcel in) { this.formStatus = in.readString(); this.role = in.readString(); this.isFormDeployed = in.readString(); - this.details_url = in.readString(); + this.detailsUrl = in.readString(); this.comment = in.readString(); this.formType = in.readString(); this.formSubmissionId = in.readString(); diff --git a/collect_app/src/main/java/org/fieldsight/naxa/data/FieldSightNotificationBuilder.java b/collect_app/src/main/java/org/fieldsight/naxa/data/FieldSightNotificationBuilder.java index cd22d50f0..303068d72 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/data/FieldSightNotificationBuilder.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/data/FieldSightNotificationBuilder.java @@ -18,7 +18,7 @@ public class FieldSightNotificationBuilder { private String formStatus; private String role; private String isFormDeployed; - private String details_url; + private String detailsUrl; private String comment; private String formType; private boolean isRead; @@ -117,8 +117,8 @@ public FieldSightNotificationBuilder setIsFormDeployed(String isFormDeployed) { return this; } - public FieldSightNotificationBuilder setDetails_url(String details_url) { - this.details_url = details_url; + public FieldSightNotificationBuilder setDetailsUrl(String detailsUrl) { + this.detailsUrl = detailsUrl; return this; } @@ -150,7 +150,7 @@ public FieldSightNotificationBuilder setFormVersion(String formVersion) { public FieldSightNotification createFieldSightNotification() { return new FieldSightNotification(id, notificationType, notifiedDate, notifiedTime, idString, fsFormId, fsFormIdProject, formName, siteId, siteName, projectId, - projectName, formStatus, role, isFormDeployed, details_url, comment, + projectName, formStatus, role, isFormDeployed, detailsUrl, comment, formType, isRead, formSubmissionId, formVersion, siteIdentifier, isDeployedFromSite, scheduleFormsCount,receivedDateTime, receivedDateTimeInMillis); } diff --git a/collect_app/src/main/java/org/fieldsight/naxa/data/source/local/FieldSightNotificationLocalSource.java b/collect_app/src/main/java/org/fieldsight/naxa/data/source/local/FieldSightNotificationLocalSource.java index ba6a73692..8e4a3c724 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/data/source/local/FieldSightNotificationLocalSource.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/data/source/local/FieldSightNotificationLocalSource.java @@ -42,7 +42,7 @@ public class FieldSightNotificationLocalSource implements BaseLocalDataSource<FieldSightNotification> { - private static FieldSightNotificationLocalSource INSTANCE; + private static FieldSightNotificationLocalSource fieldSightNotificationLocalSource; private final FieldSightNotificationDAO dao; @@ -59,11 +59,8 @@ public class FieldSightNotificationLocalSource implements BaseLocalDataSource<Fi String submissionDateTime; - String date_str; + String dateStr; String localTime; - Boolean notificationStatus = false; - - String comment; String fsFormId; String fsFormIdProject; String fsFormSubmissionId; @@ -81,10 +78,10 @@ public class FieldSightNotificationLocalSource implements BaseLocalDataSource<Fi String siteIdentifier; public synchronized static FieldSightNotificationLocalSource getInstance() { - if (INSTANCE == null) { - INSTANCE = new FieldSightNotificationLocalSource(); + if (fieldSightNotificationLocalSource == null) { + fieldSightNotificationLocalSource = new FieldSightNotificationLocalSource(); } - return INSTANCE; + return fieldSightNotificationLocalSource; } private FieldSightNotificationLocalSource() { @@ -137,13 +134,13 @@ public Maybe<Integer> anyFormsOutOfSync() { public Maybe<Integer> anyFormStatusChangeOutOfSync() { return dao.countForNotificationType(false, - Constant.NotificationType.FORM_FLAG + FORM_FLAG ); } public void markFormStatusChangeAsRead() { AsyncTask.execute(() -> dao.applyReadToNotificationType(true, - Constant.NotificationType.FORM_FLAG)); + FORM_FLAG)); } public void markSitesAsRead() { @@ -431,7 +428,7 @@ public FieldSightNotification parseNotificationData(JSONObject jsonObject) { FieldSightNotification notification = new FieldSightNotificationBuilder() - .setDetails_url(notificationDetailsUrl) + .setDetailsUrl(notificationDetailsUrl) .setNotificationType(notifyType) .setFsFormId(fsFormId) .setFormName(formName) @@ -441,7 +438,7 @@ public FieldSightNotification parseNotificationData(JSONObject jsonObject) { .setProjectName(projectName) .setFormStatus(formStatus) .setSiteIdentifier(siteIdentifier) - .setNotifiedDate(date_str) + .setNotifiedDate(dateStr) .setNotifiedTime(localTime) .setIdString(jrFormId) .setComment(formComment) diff --git a/collect_app/src/main/java/org/fieldsight/naxa/educational/EduMatImageDetailsActivity.java b/collect_app/src/main/java/org/fieldsight/naxa/educational/EduMatImageDetailsActivity.java index a0c3826d5..b19c56fad 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/educational/EduMatImageDetailsActivity.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/educational/EduMatImageDetailsActivity.java @@ -47,29 +47,29 @@ public void onClick(View v) { Bundle bundle = getIntent().getExtras(); if (bundle != null) { - String image_url_on = bundle.getString("IMAGE_URL_ON"); - String image_url_off = bundle.getString("IMAGE_URL_OFF"); - String image_title = bundle.getString("IMAGE_TITLE"); - String image_desc = bundle.getString("IMAGE_DESC"); + String imageUrlOn = bundle.getString("IMAGE_URL_ON"); + String imageUrlOff = bundle.getString("IMAGE_URL_OFF"); + String imageTitle1 = bundle.getString("IMAGE_TITLE"); + String imageDesc1 = bundle.getString("IMAGE_DESC"); - getSupportActionBar().setTitle(image_title); + getSupportActionBar().setTitle(imageTitle1); - if (image_url_off != null) { - File f = new File(image_url_off); + if (imageUrlOff != null) { + File f = new File(imageUrlOff); Bitmap bmp = BitmapFactory.decodeFile(f.getAbsolutePath()); imageView.setImageBitmap(bmp); } else { GlideApp.with(this) - .load(image_url_on) + .load(imageUrlOn) .diskCacheStrategy(DiskCacheStrategy.ALL) .into(imageView); } // usingSimpleImage(imageView); - imageTitle.setText(image_title); - imageDesc.setText(image_desc); + imageTitle.setText(imageTitle1); + imageDesc.setText(imageDesc1); } } diff --git a/collect_app/src/main/java/org/fieldsight/naxa/educational/EduMat_ViewTextTitleDetailsActivity.java b/collect_app/src/main/java/org/fieldsight/naxa/educational/EduMatViewTextTitleDetailsActivity.java similarity index 75% rename from collect_app/src/main/java/org/fieldsight/naxa/educational/EduMat_ViewTextTitleDetailsActivity.java rename to collect_app/src/main/java/org/fieldsight/naxa/educational/EduMatViewTextTitleDetailsActivity.java index 589a7e1a4..1b9dfdfc2 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/educational/EduMat_ViewTextTitleDetailsActivity.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/educational/EduMatViewTextTitleDetailsActivity.java @@ -15,7 +15,7 @@ * Created by susan on 7/18/2017. */ -public class EduMat_ViewTextTitleDetailsActivity extends CollectAbstractActivity { +public class EduMatViewTextTitleDetailsActivity extends CollectAbstractActivity { @Override protected void onCreate(@Nullable Bundle savedInstanceState) { @@ -37,12 +37,12 @@ public void onClick(View v) { Bundle bundle = getIntent().getExtras(); if (bundle != null) { - String text_title = bundle.getString("TEXT_TITLE"); - String text_desc = bundle.getString("TEXT_DESC"); - getSupportActionBar().setTitle(text_title); + String textTitle = bundle.getString("TEXT_TITLE"); + String textDesc = bundle.getString("TEXT_DESC"); + getSupportActionBar().setTitle(textTitle); - tvTitle.setText(text_title); - tvDesc.setText(text_desc); + tvTitle.setText(textTitle); + tvDesc.setText(textDesc); } } } \ No newline at end of file diff --git a/collect_app/src/main/java/org/fieldsight/naxa/educational/EduMat_ViewVideoDetailsActivity.java b/collect_app/src/main/java/org/fieldsight/naxa/educational/EduMatViewVideoDetailsActivity.java similarity index 79% rename from collect_app/src/main/java/org/fieldsight/naxa/educational/EduMat_ViewVideoDetailsActivity.java rename to collect_app/src/main/java/org/fieldsight/naxa/educational/EduMatViewVideoDetailsActivity.java index 8cb96323a..d842026e6 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/educational/EduMat_ViewVideoDetailsActivity.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/educational/EduMatViewVideoDetailsActivity.java @@ -18,7 +18,7 @@ * Created by susan on 7/18/2017. */ -public class EduMat_ViewVideoDetailsActivity extends CollectAbstractActivity { +public class EduMatViewVideoDetailsActivity extends CollectAbstractActivity { @Override protected void onCreate(@Nullable Bundle savedInstanceState) { @@ -42,18 +42,18 @@ public void onClick(View v) { Bundle bundle = getIntent().getExtras(); if (bundle != null) { - String video_url = bundle.getString("VIDEO_URL"); - String video_title = bundle.getString("VIDEO_TITLE"); - String video_desc = bundle.getString("VIDEO_DESC"); + String videoUrl = bundle.getString("VIDEO_URL"); + String videoTitle = bundle.getString("VIDEO_TITLE"); + String videoDesc = bundle.getString("VIDEO_DESC"); // myVideoView.setVideoPath(thumbnail_url); - myVideoView.setVideoURI(Uri.parse(video_url)); + myVideoView.setVideoURI(Uri.parse(videoUrl)); myVideoView.setMediaController(new MediaController(this)); myVideoView.requestFocus(); myVideoView.start(); - imageTitle.setText(video_title); - imageDesc.setText(video_desc); + imageTitle.setText(videoTitle); + imageDesc.setText(videoDesc); } } } \ No newline at end of file diff --git a/collect_app/src/main/java/org/fieldsight/naxa/educational/Edu_Video_Model.java b/collect_app/src/main/java/org/fieldsight/naxa/educational/EduVideoModel.java similarity index 63% rename from collect_app/src/main/java/org/fieldsight/naxa/educational/Edu_Video_Model.java rename to collect_app/src/main/java/org/fieldsight/naxa/educational/EduVideoModel.java index 0cb1a6f6d..e5b157d5b 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/educational/Edu_Video_Model.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/educational/EduVideoModel.java @@ -4,19 +4,19 @@ * Created by susan on 7/5/2017. */ -public class Edu_Video_Model { +public class EduVideoModel { private String videoFile; - private String thumbnail_url; + private String thumbnailUrl; private String title; private String desc; - public Edu_Video_Model() { + public EduVideoModel() { } - public Edu_Video_Model(String videoFile, String thumbnail_url, String title, String desc) { + public EduVideoModel(String videoFile, String thumbnailUrl, String title, String desc) { this.videoFile = videoFile; - this.thumbnail_url = thumbnail_url; + this.thumbnailUrl = thumbnailUrl; this.title = title; this.desc = desc; } @@ -29,13 +29,13 @@ public void setVideoFile(String videoFile) { this.videoFile = videoFile; } - public String getThumbnail_url() { + public String getThumbnailUrl() { - return thumbnail_url; + return thumbnailUrl; } - public void setThumbnail_url(String thumbnail_url) { - this.thumbnail_url = thumbnail_url; + public void setThumbnailUrl(String thumbnailUrl) { + this.thumbnailUrl = thumbnailUrl; } public String getTitle() { diff --git a/collect_app/src/main/java/org/fieldsight/naxa/educational/EducationalMaterialRecyclerViewAdapter.java b/collect_app/src/main/java/org/fieldsight/naxa/educational/EducationalMaterialRecyclerViewAdapter.java index 1491ec0a3..72957776e 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/educational/EducationalMaterialRecyclerViewAdapter.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/educational/EducationalMaterialRecyclerViewAdapter.java @@ -128,7 +128,7 @@ public int getItemViewType(int position) { return TEXT_VIEW; } else if (items.get(position) instanceof Edu_Image_Model) { return IMAGE; - } else if (items.get(position) instanceof Edu_Video_Model) { + } else if (items.get(position) instanceof EduVideoModel) { return VIDEO; } else if (items.get(position) instanceof Edu_PDF_Model) { return PDF; @@ -148,7 +148,7 @@ private void configureViewHolderText(ViewHolderText vh1, int position) { @Override public void onClick(View v) { Bundle bundle = new Bundle(); - Intent intent = new Intent(context, EduMat_ViewTextTitleDetailsActivity.class); + Intent intent = new Intent(context, EduMatViewTextTitleDetailsActivity.class); bundle.putSerializable("TEXT_TITLE", user.getTitle()); bundle.putSerializable("TEXT_DESC", user.getDesc()); intent.putExtras(bundle); @@ -160,7 +160,7 @@ public void onClick(View v) { @Override public void onClick(View v) { Bundle bundle = new Bundle(); - Intent intent = new Intent(context, EduMat_ViewTextTitleDetailsActivity.class); + Intent intent = new Intent(context, EduMatViewTextTitleDetailsActivity.class); bundle.putSerializable("TEXT_TITLE", user.getTitle()); bundle.putSerializable("TEXT_DESC", user.getDesc()); intent.putExtras(bundle); @@ -172,7 +172,7 @@ public void onClick(View v) { @Override public void onClick(View v) { Bundle bundle = new Bundle(); - Intent intent = new Intent(context, EduMat_ViewTextTitleDetailsActivity.class); + Intent intent = new Intent(context, EduMatViewTextTitleDetailsActivity.class); bundle.putSerializable("TEXT_TITLE", user.getTitle()); bundle.putSerializable("TEXT_DESC", user.getDesc()); intent.putExtras(bundle); @@ -238,14 +238,14 @@ public void onClick(View v) { //Video View Holder private void configureViewHolderVideo(ViewHolderVideo vh3, int position) { - final Edu_Video_Model edu_video_model = (Edu_Video_Model) items.get(position); + final EduVideoModel edu_video_model = (EduVideoModel) items.get(position); if (edu_video_model != null) { ViewHolderVideo.videoView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Bundle bundle = new Bundle(); - Intent intent = new Intent(context, EduMat_ViewVideoDetailsActivity.class); - bundle.putSerializable("VIDEO_THUMB_URL", edu_video_model.getThumbnail_url()); + Intent intent = new Intent(context, EduMatViewVideoDetailsActivity.class); + bundle.putSerializable("VIDEO_THUMB_URL", edu_video_model.getThumbnailUrl()); bundle.putSerializable("VIDEO_URL", edu_video_model.getVideoFile()); bundle.putSerializable("VIDEO_TITLE", edu_video_model.getTitle()); bundle.putSerializable("VIDEO_DESC", edu_video_model.getDesc()); @@ -258,8 +258,8 @@ public void onClick(View v) { @Override public void onClick(View v) { Bundle bundle = new Bundle(); - Intent intent = new Intent(context, EduMat_ViewVideoDetailsActivity.class); - bundle.putSerializable("VIDEO_THUMB_URL", edu_video_model.getThumbnail_url()); + Intent intent = new Intent(context, EduMatViewVideoDetailsActivity.class); + bundle.putSerializable("VIDEO_THUMB_URL", edu_video_model.getThumbnailUrl()); bundle.putSerializable("VIDEO_URL", edu_video_model.getVideoFile()); bundle.putSerializable("VIDEO_TITLE", edu_video_model.getTitle()); bundle.putSerializable("VIDEO_DESC", edu_video_model.getDesc()); @@ -272,8 +272,8 @@ public void onClick(View v) { @Override public void onClick(View v) { Bundle bundle = new Bundle(); - Intent intent = new Intent(context, EduMat_ViewVideoDetailsActivity.class); - bundle.putSerializable("VIDEO_THUMB_URL", edu_video_model.getThumbnail_url()); + Intent intent = new Intent(context, EduMatViewVideoDetailsActivity.class); + bundle.putSerializable("VIDEO_THUMB_URL", edu_video_model.getThumbnailUrl()); bundle.putSerializable("VIDEO_URL", edu_video_model.getVideoFile()); bundle.putSerializable("VIDEO_TITLE", edu_video_model.getTitle()); bundle.putSerializable("VIDEO_DESC", edu_video_model.getDesc()); diff --git a/collect_app/src/main/java/org/fieldsight/naxa/educational/EducationalMaterialsRemoteSource.java b/collect_app/src/main/java/org/fieldsight/naxa/educational/EducationalMaterialsRemoteSource.java index 78bca4c96..7c039c100 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/educational/EducationalMaterialsRemoteSource.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/educational/EducationalMaterialsRemoteSource.java @@ -46,14 +46,14 @@ public class EducationalMaterialsRemoteSource implements BaseRemoteDataSource<Em> { - private static EducationalMaterialsRemoteSource INSTANCE; + private static EducationalMaterialsRemoteSource educationalMaterialsRemoteSource; public synchronized static EducationalMaterialsRemoteSource getInstance() { - if (INSTANCE == null) { - INSTANCE = new EducationalMaterialsRemoteSource(); + if (educationalMaterialsRemoteSource == null) { + educationalMaterialsRemoteSource = new EducationalMaterialsRemoteSource(); } - return INSTANCE; + return educationalMaterialsRemoteSource; } private EducationalMaterialsRemoteSource() { diff --git a/collect_app/src/main/java/org/fieldsight/naxa/firebase/FCMParameter.java b/collect_app/src/main/java/org/fieldsight/naxa/firebase/FCMParameter.java index d2bd3f861..3cefa8843 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/firebase/FCMParameter.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/firebase/FCMParameter.java @@ -7,47 +7,52 @@ */ public class FCMParameter { @SerializedName("dev_id") - String dev_id; + private + String devId; @SerializedName("reg_id") - String reg_id; + private + String regId; @SerializedName("name") + private String name; @SerializedName("is_active") - String is_active; + private + String isActive; @Override public String toString() { return "FCMParameter{" + - "dev_id='" + dev_id + '\'' + - ", reg_id='" + reg_id + '\'' + + "devId='" + devId + '\'' + + ", regId='" + regId + '\'' + ", name='" + name + '\'' + - ", is_active='" + is_active + '\'' + + ", isActive='" + isActive + '\'' + '}'; } - public FCMParameter() {} + public FCMParameter() { + } public FCMParameter(String deviceId, String deviceToken, String deviceName, String deviceStatus) { - this.dev_id = deviceId; - this.reg_id = deviceToken; + this.devId = deviceId; + this.regId = deviceToken; this.name = deviceName; - this.is_active = deviceStatus; + this.isActive = deviceStatus; } - public String getDev_id() { - return dev_id; + public String getDevId() { + return devId; } - public void setDev_id(String dev_id) { - this.dev_id = dev_id; + public void setDevId(String devId) { + this.devId = devId; } - public String getReg_id() { - return reg_id; + public String getRegId() { + return regId; } - public void setReg_id(String reg_id) { - this.reg_id = reg_id; + public void setRegId(String regId) { + this.regId = regId; } public String getName() { @@ -58,11 +63,11 @@ public void setName(String name) { this.name = name; } - public String getIs_active() { - return is_active; + public String getIsActive() { + return isActive; } - public void setIs_active(String is_active) { - this.is_active = is_active; + public void setIsActive(String isActive) { + this.isActive = isActive; } } diff --git a/collect_app/src/main/java/org/fieldsight/naxa/firebase/FieldSightFirebaseMessagingService.java b/collect_app/src/main/java/org/fieldsight/naxa/firebase/FieldSightFirebaseMessagingService.java index 3e4be199b..12f345998 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/firebase/FieldSightFirebaseMessagingService.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/firebase/FieldSightFirebaseMessagingService.java @@ -54,7 +54,7 @@ public class FieldSightFirebaseMessagingService extends FirebaseMessagingService String submissionDateTime; - String date_str; + String dateStr; String localTime; @@ -99,7 +99,7 @@ public void onMessageReceived(RemoteMessage remoteMessage) { Map<String, String> notificationData = remoteMessage.getData(); parseNotificationData(notificationData); - builder.setDetails_url(notificationDetailsUrl) + builder.setDetailsUrl(notificationDetailsUrl) .setNotificationType(notifyType) .setFsFormId(fsFormId) .setFormName(formName) @@ -109,7 +109,7 @@ public void onMessageReceived(RemoteMessage remoteMessage) { .setProjectName(projectName) .setFormStatus(formStatus) .setSiteIdentifier(siteIdentifier) - .setNotifiedDate(date_str) + .setNotifiedDate(dateStr) .setNotifiedTime(localTime) .setIdString(jrFormId) .setComment(formComment) @@ -263,7 +263,7 @@ public static int getID() { private void getAndSetDateTime() { dateFormat = new SimpleDateFormat("yyyy/MM/dd", Locale.US); date = new Date(); - date_str = dateFormat.format(date); + dateStr = dateFormat.format(date); cal = Calendar.getInstance(TimeZone.getTimeZone("GMT-4:00")); currentLocalTime = cal.getTime(); date1 = new SimpleDateFormat("hh:mm a", Locale.US); @@ -273,7 +273,7 @@ private void getAndSetDateTime() { } @Override - public void onNewToken(String fcm_token) { - SharedPreferenceUtils.saveToPrefs(Collect.getInstance(), SharedPreferenceUtils.PREF_VALUE_KEY.KEY_FCM, fcm_token); - Timber.i("Messaging service, firebase %s",fcm_token); } + public void onNewToken(String fcmToken) { + SharedPreferenceUtils.saveToPrefs(Collect.getInstance(), SharedPreferenceUtils.PREF_VALUE_KEY.KEY_FCM, fcmToken); + Timber.i("Messaging service, firebase %s",fcmToken); } } diff --git a/collect_app/src/main/java/org/fieldsight/naxa/firebase/NotificationUtils.java b/collect_app/src/main/java/org/fieldsight/naxa/firebase/NotificationUtils.java index 37cdc7a2a..be3070bbf 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/firebase/NotificationUtils.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/firebase/NotificationUtils.java @@ -24,14 +24,10 @@ public class NotificationUtils { private static int uniqueMessageId = DEFAULT_DOWNLOAD_NOTIFICATION_ID + 1; private static NotificationManager mNotifyManager; private static NotificationCompat.Builder mBuilder; - public static String DOWNLOAD_ACTION = "download.action"; private static int smallIcon = R.drawable.ic_notification_icon; private static final String CHANNEL_ID = "All Notifications"; - public NotificationUtils() { - - } private static int getUniqueMessageId() { return uniqueMessageId++; @@ -98,7 +94,7 @@ public static void createStackNotification(Context context, String groupId, Inte PendingIntent p = intent != null ? PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT) : null; - androidx.core.app.NotificationCompat.Builder builder = new NotificationCompat.Builder(context, CHANNEL_ID) + NotificationCompat.Builder builder = new NotificationCompat.Builder(context, CHANNEL_ID) .setContentIntent(p) .setContentTitle(contentTitle) .setContentText(contentText) @@ -123,7 +119,7 @@ public static int createUploadNotification(int notificationId, String title) { NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); - androidx.core.app.NotificationCompat.Builder builder = new NotificationCompat.Builder(context, "upload") + NotificationCompat.Builder builder = new NotificationCompat.Builder(context, "upload") .setSmallIcon(android.R.drawable.stat_sys_upload) .setAutoCancel(true) .setContentTitle(title) @@ -157,7 +153,7 @@ public static int createProgressNotification(int notificationId, String title) { NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); - androidx.core.app.NotificationCompat.Builder builder = new NotificationCompat.Builder(context, CHANNEL_ID) + NotificationCompat.Builder builder = new NotificationCompat.Builder(context, CHANNEL_ID) .setSmallIcon(android.R.drawable.stat_sys_download) .setAutoCancel(true) .setContentTitle(title) @@ -183,7 +179,7 @@ public static int createProgressNotification() { NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); - androidx.core.app.NotificationCompat.Builder builder = new NotificationCompat.Builder(context, CHANNEL_ID) + NotificationCompat.Builder builder = new NotificationCompat.Builder(context, CHANNEL_ID) .setSmallIcon(android.R.drawable.stat_sys_download) .setAutoCancel(true) .setContentTitle("Looking for educational materials") @@ -205,7 +201,7 @@ static void finishedProgressNotification(int notificationId, String msg) { NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); - androidx.core.app.NotificationCompat.Builder builder = new NotificationCompat.Builder(context, CHANNEL_ID) + NotificationCompat.Builder builder = new NotificationCompat.Builder(context, CHANNEL_ID) .setSmallIcon(android.R.drawable.stat_sys_download_done) .setContentText(msg); @@ -227,7 +223,7 @@ public static void notifyHeadsUp(String title, String msg) { NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); - androidx.core.app.NotificationCompat.Builder builder = new NotificationCompat.Builder(context, CHANNEL_ID) + NotificationCompat.Builder builder = new NotificationCompat.Builder(context, CHANNEL_ID) .setSmallIcon(R.drawable.ic_notification_icon) .setContentTitle(title) .setTicker(msg) @@ -250,7 +246,7 @@ public static void updateProgressNotification(int notificationId, String msg, in NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); - androidx.core.app.NotificationCompat.Builder builder = new NotificationCompat.Builder(context, CHANNEL_ID) + NotificationCompat.Builder builder = new NotificationCompat.Builder(context, CHANNEL_ID) .setSmallIcon(android.R.drawable.stat_sys_download) .setContentText(msg) .setProgress(total, progress, false); @@ -330,7 +326,7 @@ private static Notification createNotification(Context ctx, PendingIntent.FLAG_ONE_SHOT); - androidx.core.app.NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(ctx) + NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(ctx) .setSmallIcon(icon).setContentText(tickerText).setWhen(when) .setContentTitle(contentText) .setTicker(tickerText) @@ -384,7 +380,7 @@ public static int notifyAPI(String title, String msg) { NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); - androidx.core.app.NotificationCompat.Builder builder = new NotificationCompat.Builder(context) + NotificationCompat.Builder builder = new NotificationCompat.Builder(context) .setSmallIcon(android.R.drawable.stat_sys_download) .setAutoCancel(true) .setContentTitle(title) diff --git a/collect_app/src/main/java/org/fieldsight/naxa/flagform/FlagFormRemoteSource.java b/collect_app/src/main/java/org/fieldsight/naxa/flagform/FlagFormRemoteSource.java index 0ab4accb8..b29bfeb9c 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/flagform/FlagFormRemoteSource.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/flagform/FlagFormRemoteSource.java @@ -51,13 +51,13 @@ private FlagFormRemoteSource() { } Observable<String> getXMLInstance(String submissionId) { - String INSTANCES_PATH = Collect.FORMS_PATH.replace(Environment.getExternalStorageDirectory().toString(), ""); + String instancePath = Collect.FORMS_PATH.replace(Environment.getExternalStorageDirectory().toString(), ""); String url = String.format(FieldSightUserSession.getServerUrl(Collect.getInstance()) + "/forms/api/instance/download_xml_version/%s", submissionId); return new RxDownloader(Collect.getInstance()) - .download(url, "temp.xml", INSTANCES_PATH, "*/*", true); + .download(url, "temp.xml", instancePath, "*/*", true); } diff --git a/collect_app/src/main/java/org/fieldsight/naxa/flagform/FlaggedInstanceActivity.java b/collect_app/src/main/java/org/fieldsight/naxa/flagform/FlaggedInstanceActivity.java index b0706c83f..9ad764d3e 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/flagform/FlaggedInstanceActivity.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/flagform/FlaggedInstanceActivity.java @@ -613,7 +613,7 @@ private void initrecyclerViewImages(List<NotificationImage> framelist) { private void getNotificationDetail() { - String url = FieldSightUserSession.getServerUrl(Collect.getInstance()) + loadedFieldSightNotification.getDetails_url(); + String url = FieldSightUserSession.getServerUrl(Collect.getInstance()) + loadedFieldSightNotification.getDetailsUrl(); ServiceGenerator.getRxClient().create(ApiInterface.class) .getNotificationDetail(url) diff --git a/collect_app/src/main/java/org/fieldsight/naxa/forms/data/local/FieldSightFormDetails.java b/collect_app/src/main/java/org/fieldsight/naxa/forms/data/local/FieldSightFormDetails.java index a4ded45ff..20bf8572e 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/forms/data/local/FieldSightFormDetails.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/forms/data/local/FieldSightFormDetails.java @@ -27,7 +27,7 @@ public class FieldSightFormDetails extends FormDetails { @SerializedName("PROJECT") private String formDeployedProjectId; - @SerializedName("site_project_id") + @SerializedName("siteProjectId") private Integer projectId; @SerializedName("name") diff --git a/collect_app/src/main/java/org/fieldsight/naxa/forms/data/local/FieldsightFormDetailsv3.java b/collect_app/src/main/java/org/fieldsight/naxa/forms/data/local/FieldsightFormDetailsv3.java index 75b5e8f4f..767725d31 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/forms/data/local/FieldsightFormDetailsv3.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/forms/data/local/FieldsightFormDetailsv3.java @@ -33,7 +33,7 @@ public class FieldsightFormDetailsv3 { String project; @ColumnInfo(name = "site_project_id") - String site_project_id; + String siteProjectId; @ColumnInfo(name = "type") String type; @@ -52,9 +52,6 @@ public class FieldsightFormDetailsv3 { String metaAttributes; - public FieldsightFormDetailsv3() { - - } public String getId() { return id; @@ -80,12 +77,12 @@ public void setProject(String project) { this.project = project; } - public String getSite_project_id() { - return site_project_id; + public String getSiteProjectId() { + return siteProjectId; } - public void setSite_project_id(String site_project_id) { - this.site_project_id = site_project_id; + public void setSiteProjectId(String siteProjectId) { + this.siteProjectId = siteProjectId; } public String getType() { @@ -155,7 +152,7 @@ public static FieldsightFormDetailsv3 parseFromJSON(JSONObject jsonObject, Strin FormDetails formDetails = formDetailsfromJSON(jsonObject); fieldsightFormDetailsv3.setId(jsonObject.optString("id")); fieldsightFormDetailsv3.setProject(jsonObject.optString("PROJECT")); - fieldsightFormDetailsv3.setSite_project_id(jsonObject.optString("site_project_id")); + fieldsightFormDetailsv3.setSiteProjectId(jsonObject.optString("siteProjectId")); fieldsightFormDetailsv3.setSite(jsonObject.optString("site")); fieldsightFormDetailsv3.setFormDetails(formDetailsfromJSON(jsonObject)); Timber.i("Fieldsightformdetailsv3, type = %s, em = %s", type, jsonObject.optString("em")); @@ -219,7 +216,7 @@ public static List<FieldsightFormDetailsv3> fieldsightFormDetailsV3FromJSON(JSON JSONObject subStageFormDetailJSON = subStageFormJSON.optJSONObject("stage_forms"); fieldsightFormDetails.setId(subStageFormDetailJSON.optString("id")); fieldsightFormDetails.setProject(subStageFormDetailJSON.optString("PROJECT")); - fieldsightFormDetails.setSite_project_id(subStageFormDetailJSON.optString("site_project_id")); + fieldsightFormDetails.setSiteProjectId(subStageFormDetailJSON.optString("siteProjectId")); fieldsightFormDetails.setSite(subStageFormDetailJSON.optString("site")); fieldsightFormDetails.setFormDetails(formDetailsfromJSON(subStageFormDetailJSON)); diff --git a/collect_app/src/main/java/org/fieldsight/naxa/forms/data/remote/FieldSightFormRemoteSourceV3.java b/collect_app/src/main/java/org/fieldsight/naxa/forms/data/remote/FieldSightFormRemoteSourceV3.java index 1bea394d0..3ffb307b4 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/forms/data/remote/FieldSightFormRemoteSourceV3.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/forms/data/remote/FieldSightFormRemoteSourceV3.java @@ -169,9 +169,9 @@ private void updateProjectIdUrlMap(FieldsightFormDetailsv3 fieldsightFormDetails projectIdUrlMap.put(projectId, projectIdUrlMap.get(projectId, 0) + 1); } private Integer getProjectId(FieldsightFormDetailsv3 fieldSightForm) { - String value = TextUtils.isEmpty(fieldSightForm.getProject()) || TextUtils.equals(fieldSightForm.getProject(), "null")? fieldSightForm.getSite_project_id() : fieldSightForm.getProject(); + String value = TextUtils.isEmpty(fieldSightForm.getProject()) || TextUtils.equals(fieldSightForm.getProject(), "null")? fieldSightForm.getSiteProjectId() : fieldSightForm.getProject(); Timber.i("Fieldsightformremotesourcev3, id = %s, value = %s, projectName = %s, PROJECT = %s, site_project_id = %s", - fieldSightForm.getId(), value, fieldSightForm.getDescription(), fieldSightForm.getProject(), fieldSightForm.getSite_project_id()); + fieldSightForm.getId(), value, fieldSightForm.getDescription(), fieldSightForm.getProject(), fieldSightForm.getSiteProjectId()); return Integer.parseInt(value); } diff --git a/collect_app/src/main/java/org/fieldsight/naxa/forms/ui/EducationalMaterialListActivity.java b/collect_app/src/main/java/org/fieldsight/naxa/forms/ui/EducationalMaterialListActivity.java index a65656bd9..d8b45876c 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/forms/ui/EducationalMaterialListActivity.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/forms/ui/EducationalMaterialListActivity.java @@ -52,7 +52,7 @@ public class EducationalMaterialListActivity extends CollectAbstractActivity { List<Fragment> fragments = new ArrayList<>(); - private static final int defaultPagerPosition = 0; + private static final int DEFAULT_PAGER_POSITION = 0; private PagerAdapter mPagerAdapter; public ViewPager viewPager; public TabLayout tabLayout; @@ -115,7 +115,7 @@ private void setupViewPager() { mPagerAdapter = new PagerAdapter(getSupportFragmentManager(), fragments); viewPager.setAdapter(mPagerAdapter); tabLayout.setupWithViewPager(viewPager); - viewPager.setCurrentItem(defaultPagerPosition); + viewPager.setCurrentItem(DEFAULT_PAGER_POSITION); viewPager.setPageMargin(ViewUtils.dp2px(getApplicationContext(), 16)); viewPager.setClipToPadding(false); viewPager.setPadding(16, 16, 16, 0); @@ -181,7 +181,7 @@ public Fragment apply(Em educationMaterial) { public void onSuccess(List<Fragment> dynamicFragments) { fragments.addAll(dynamicFragments); mPagerAdapter.notifyDataSetChanged(); - viewPager.setCurrentItem(defaultPagerPosition, false); + viewPager.setCurrentItem(DEFAULT_PAGER_POSITION, false); } @Override diff --git a/collect_app/src/main/java/org/fieldsight/naxa/forms/ui/FieldSightFormListFragment.java b/collect_app/src/main/java/org/fieldsight/naxa/forms/ui/FieldSightFormListFragment.java index c1b73638d..7ccee34ef 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/forms/ui/FieldSightFormListFragment.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/forms/ui/FieldSightFormListFragment.java @@ -5,7 +5,6 @@ import androidx.annotation.Nullable; import org.fieldsight.naxa.common.BaseFormListFragment; -import org.fieldsight.naxa.common.Constant; import org.fieldsight.naxa.login.model.Project; import org.fieldsight.naxa.login.model.Site; @@ -34,8 +33,8 @@ public static FieldSightFormListFragment newInstance(String loadFormType, Site s site.setProject(project.getId()); } - bundle.putParcelable(Constant.EXTRA_OBJECT, site); - bundle.putString(Constant.EXTRA_ID, loadFormType); + bundle.putParcelable(EXTRA_OBJECT, site); + bundle.putString(EXTRA_ID, loadFormType); fragment.setArguments(bundle); return fragment; } diff --git a/collect_app/src/main/java/org/fieldsight/naxa/generalforms/GeneralFormsFragment.java b/collect_app/src/main/java/org/fieldsight/naxa/generalforms/GeneralFormsFragment.java index 01d8ee54d..4f5459635 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/generalforms/GeneralFormsFragment.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/generalforms/GeneralFormsFragment.java @@ -77,10 +77,6 @@ public static GeneralFormsFragment newInstance(Site loadedSite) { } - public GeneralFormsFragment() { - - } - @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { diff --git a/collect_app/src/main/java/org/fieldsight/naxa/generalforms/data/GeneralForm.java b/collect_app/src/main/java/org/fieldsight/naxa/generalforms/data/GeneralForm.java index e6e9c8d7d..04a514917 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/generalforms/data/GeneralForm.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/generalforms/data/GeneralForm.java @@ -70,7 +70,8 @@ public class GeneralForm { @SerializedName("site") @Expose private String siteId; - @SerializedName(value = "PROJECT") + + @SerializedName("PROJECT") @Expose private String projectId; diff --git a/collect_app/src/main/java/org/fieldsight/naxa/generalforms/data/GeneralFormLocalSource.java b/collect_app/src/main/java/org/fieldsight/naxa/generalforms/data/GeneralFormLocalSource.java index 9a4d8d56e..616dcabc8 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/generalforms/data/GeneralFormLocalSource.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/generalforms/data/GeneralFormLocalSource.java @@ -198,10 +198,10 @@ public LiveData<List<GeneralForm>> getAll() { @Override public void save(GeneralForm... items) { - io.reactivex.Observable.just(items) + Observable.just(items) .flatMap(generalForms -> { dao.insert(generalForms); - return io.reactivex.Observable.empty(); + return Observable.empty(); }) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) diff --git a/collect_app/src/main/java/org/fieldsight/naxa/helpers/FSInstancesDao.java b/collect_app/src/main/java/org/fieldsight/naxa/helpers/FSInstancesDao.java index 67f55aeb8..239b7a85c 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/helpers/FSInstancesDao.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/helpers/FSInstancesDao.java @@ -5,7 +5,6 @@ import androidx.loader.content.CursorLoader; -import org.fieldsight.naxa.common.Constant; import org.fieldsight.naxa.common.FieldSightUserSession; import org.fieldsight.naxa.network.APIEndpoint; import org.fieldsight.naxa.site.db.SiteUploadHistoryLocalSource; @@ -288,10 +287,10 @@ public Integer apply(Instance instance) { private String getFormDeployedFrom(String url) { String[] split = url.split("/"); - if (Constant.FormDeploymentFrom.PROJECT.equals(split[split.length - 3])) { - return Constant.FormDeploymentFrom.PROJECT; + if ( PROJECT.equals(split[split.length - 3])) { + return PROJECT; } else { - return Constant.FormDeploymentFrom.SITE; + return SITE; } } @@ -311,8 +310,7 @@ public List<Instance> getBySiteId(String siteId) { String[] selectionArgs = new String[]{siteId}; cursor = getInstancesCursor(selection, selectionArgs); - List<Instance> list = getInstancesFromCursor(cursor); - return list; + return getInstancesFromCursor(cursor); } diff --git a/collect_app/src/main/java/org/fieldsight/naxa/login/LoginModelImpl.java b/collect_app/src/main/java/org/fieldsight/naxa/login/LoginModelImpl.java index a6a4267ce..21e7633dc 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/login/LoginModelImpl.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/login/LoginModelImpl.java @@ -48,7 +48,7 @@ public ObservableSource<FCMParameter> apply(AuthResponse authResponse) { .flatMap(new Function<FCMParameter, ObservableSource<FCMParameter>>() { @Override public ObservableSource<FCMParameter> apply(FCMParameter fcmParameter) throws Exception { - if ("false".equals(fcmParameter.getIs_active())) { + if ("false".equals(fcmParameter.getIsActive())) { throw new FirebaseTokenException("Failed to add TOKEN in server"); } @@ -108,7 +108,7 @@ public ObservableSource<FCMParameter> apply(AuthResponse authResponse) { .flatMap(new Function<FCMParameter, ObservableSource<FCMParameter>>() { @Override public ObservableSource<FCMParameter> apply(FCMParameter fcmParameter) throws Exception { - if ("false".equals(fcmParameter.getIs_active())) { + if ("false".equals(fcmParameter.getIsActive())) { throw new FirebaseTokenException("Failed to add TOKEN in server"); } FieldSightUserSession.saveAuthToken(authResponse.getToken()); diff --git a/collect_app/src/main/java/org/fieldsight/naxa/login/model/Project.java b/collect_app/src/main/java/org/fieldsight/naxa/login/model/Project.java index 9cb6840d9..5109253d5 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/login/model/Project.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/login/model/Project.java @@ -98,15 +98,15 @@ public void setStatusMessage(String statusMessage) { @Ignore String statusMessage = ""; - public String getTerms_and_labels() { - return terms_and_labels; + public String getTermsAndLabels() { + return termsAndLabels; } - public void setTerms_and_labels(String terms_and_labels) { - this.terms_and_labels = terms_and_labels; + public void setTermsAndLabels(String termsAndLabels) { + this.termsAndLabels = termsAndLabels; } - private String terms_and_labels = ""; + private String termsAndLabels = ""; public long getSyncedDate() { return syncedDate; @@ -283,7 +283,7 @@ public void setSyncedWithRemote(boolean syncedWithRemote) { - public Project(@NonNull String id, String name, String description, String address, String lat, String lon, String siteClusters, String organizationName, String organizationlogourl, Boolean hasClusteredSites, Integer typeId, String typeLabel, String phone, boolean isSyncedWithRemote, List<SiteMetaAttribute> metaAttributes, String url, String terms_and_labels) { + public Project(@NonNull String id, String name, String description, String address, String lat, String lon, String siteClusters, String organizationName, String organizationlogourl, Boolean hasClusteredSites, Integer typeId, String typeLabel, String phone, boolean isSyncedWithRemote, List<SiteMetaAttribute> metaAttributes, String url, String termsAndLabels) { this.id = id; this.name = name; this.description = description; @@ -300,7 +300,7 @@ public Project(@NonNull String id, String name, String description, String addre this.isSyncedWithRemote = isSyncedWithRemote; this.siteMetaAttributes = metaAttributes; this.url = url; - this.terms_and_labels = terms_and_labels; + this.termsAndLabels = termsAndLabels; } @@ -329,7 +329,7 @@ public void writeToParcel(Parcel dest, int flags) { dest.writeByte(this.checked ? (byte) 1 : (byte) 0); dest.writeByte(this.isSynced ? (byte) 1 : (byte) 0); dest.writeString(this.statusMessage); - dest.writeString(this.terms_and_labels); + dest.writeString(this.termsAndLabels); dest.writeLong(this.syncedDate); dest.writeTypedList(this.regionList); dest.writeTypedList(this.siteMetaAttributes); @@ -354,7 +354,7 @@ protected Project(Parcel in) { this.checked = in.readByte() != 0; this.isSynced = in.readByte() != 0; this.statusMessage = in.readString(); - this.terms_and_labels = in.readString(); + this.termsAndLabels = in.readString(); this.syncedDate = in.readLong(); this.regionList = in.createTypedArrayList(Region.CREATOR); this.siteMetaAttributes = in.createTypedArrayList(SiteMetaAttribute.CREATOR); diff --git a/collect_app/src/main/java/org/fieldsight/naxa/login/model/User.java b/collect_app/src/main/java/org/fieldsight/naxa/login/model/User.java index ed83b6573..0e7f236fb 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/login/model/User.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/login/model/User.java @@ -17,7 +17,7 @@ public class User { @SerializedName("my_sites") private List<MySites> mySitesModel = new ArrayList<MySites>(); @SerializedName("username") - private String user_name; + private String userName; @SerializedName("server_time") private String serverTime; private String id; @@ -99,9 +99,6 @@ public class User { private boolean sync; - public User() { - } - /** * @return The mySitesModel */ @@ -139,8 +136,8 @@ public void setEmail(String email) { } - public String getUser_name() { - return user_name; + public String getUserName() { + return userName; } public String getFullName() { @@ -155,8 +152,8 @@ public void setMySitesModel(List<MySites> mySitesModel) { this.mySitesModel = mySitesModel; } - public void setUser_name(String user_name) { - this.user_name = user_name; + public void setUserName(String userName) { + this.userName = userName; } public String getProfilepic() { @@ -387,7 +384,7 @@ public boolean equals(Object o) { User user = (User) o; return sync == user.sync && Objects.equal(mySitesModel, user.mySitesModel) && - Objects.equal(user_name, user.user_name) && + Objects.equal(userName, user.userName) && Objects.equal(serverTime, user.serverTime) && Objects.equal(profilepic, user.profilepic) && Objects.equal(firstName, user.firstName) && @@ -419,6 +416,6 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hashCode(mySitesModel, user_name, serverTime, profilepic, firstName, lastName, email, phone, address, gender, skype, primaryNumber, secondaryNumber, officeNumber, viber, whatsApp, wechat, line, tango, hike, qq, googleTalk, twitter, organization, project, isSupervisor, lastLogin, organizationUrl, additionalProperties, sync); + return Objects.hashCode(mySitesModel, userName, serverTime, profilepic, firstName, lastName, email, phone, address, gender, skype, primaryNumber, secondaryNumber, officeNumber, viber, whatsApp, wechat, line, tango, hike, qq, googleTalk, twitter, organization, project, isSupervisor, lastLogin, organizationUrl, additionalProperties, sync); } } diff --git a/collect_app/src/main/java/org/fieldsight/naxa/migrate/MigrateFieldSightViewModel.java b/collect_app/src/main/java/org/fieldsight/naxa/migrate/MigrateFieldSightViewModel.java index 72508128d..7661ce4f0 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/migrate/MigrateFieldSightViewModel.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/migrate/MigrateFieldSightViewModel.java @@ -221,8 +221,9 @@ private SQLiteDatabase getFormsDB() { String dbPath = migrationHelper.getOldRootPath() + File.separator + MigrationHelper.Folder.METADATA + File.separator + MigrationHelper.Database.FORMS; File dbfile = new File(dbPath); - if (!dbfile.exists()) + if (!dbfile.exists()) { throw new RuntimeException("Forms Database does not exist for " + usernameOrEmail); + } return SQLiteDatabase.openOrCreateDatabase(dbfile, null); } @@ -259,9 +260,6 @@ private SQLiteDatabase getInstancesDB() { return SQLiteDatabase.openOrCreateDatabase(dbfile, null); } - public MigrateFieldSightViewModel() { - - } Observable<Integer> copyFromOldAccount() { diff --git a/collect_app/src/main/java/org/fieldsight/naxa/migrate/MigrationHelper.java b/collect_app/src/main/java/org/fieldsight/naxa/migrate/MigrationHelper.java index 7392a403d..7dc256ee3 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/migrate/MigrationHelper.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/migrate/MigrationHelper.java @@ -47,7 +47,9 @@ public static File getFileByPath(final String filePath) { } private static boolean isSpace(final String s) { - if (s == null) return true; + if (s == null) { + return true; + } for (int i = 0, len = s.length(); i < len; ++i) { if (!Character.isWhitespace(s.charAt(i))) { return false; @@ -92,7 +94,9 @@ public boolean accept(File pathname) { public static List<File> listFilesInDirWithFilter(final File dir, final FileFilter filter, final boolean isRecursive) { - if (!isDir(dir)) return null; + if (!isDir(dir)) { + return null; + } List<File> list = new ArrayList<>(); File[] files = dir.listFiles(); if (files != null && files.length != 0) { diff --git a/collect_app/src/main/java/org/fieldsight/naxa/network/ApiInterface.java b/collect_app/src/main/java/org/fieldsight/naxa/network/ApiInterface.java index 01f2b10c6..1dcf316ab 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/network/ApiInterface.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/network/ApiInterface.java @@ -116,8 +116,8 @@ Observable<Site> uploadSite(@Url String url, @Multipart @POST Observable<User> updateUserProfileNoImage(@Url String url, - @Part("first_name") RequestBody first_name, - @Part("last_name") RequestBody last_name, + @Part("first_name") RequestBody firstName, + @Part("last_name") RequestBody lastName, @Part("address") RequestBody address, @Part("gender") RequestBody gender, @Part("phone") RequestBody phone, @@ -212,7 +212,7 @@ Call<Site> updateSiteInfo(@Url String url, @Part("additional_desc") RequestBody addDesc, // @Part("type") RequestBody type, @Part MultipartBody.Part logoFile, - @Part("site_meta_attributes_ans") RequestBody meta_ans, + @Part("site_meta_attributes_ans") RequestBody metaAns, @Part("latitude") RequestBody lat, @Part("longitude") RequestBody lon ); @@ -244,7 +244,7 @@ Call<Site> updateSiteInfoWithNoImage(@Url String url, @Part("public_desc") RequestBody publicDesc, @Part("additional_desc") RequestBody addDesc, // @Part("type") RequestBody type, - @Part("site_meta_attributes_ans") RequestBody meta_ans, + @Part("site_meta_attributes_ans") RequestBody metaAns, @Part("latitude") RequestBody lat, @Part("longitude") RequestBody lon ); diff --git a/collect_app/src/main/java/org/fieldsight/naxa/network/NetworkUtils.java b/collect_app/src/main/java/org/fieldsight/naxa/network/NetworkUtils.java index 7beb38cd4..81195eee2 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/network/NetworkUtils.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/network/NetworkUtils.java @@ -8,16 +8,16 @@ public class NetworkUtils { - private NetworkUtils(){ + private NetworkUtils() { } private static NetworkInfo getNetworkStat() { Context ctx = Collect.getInstance().getApplicationContext(); ConnectivityManager cm = (ConnectivityManager) ctx.getSystemService(Context.CONNECTIVITY_SERVICE); - if (cm != null) + if (cm != null) { return cm.getActiveNetworkInfo(); - else { + } else { return null; } } diff --git a/collect_app/src/main/java/org/fieldsight/naxa/notificationslist/NotificationsAdapter.java b/collect_app/src/main/java/org/fieldsight/naxa/notificationslist/NotificationsAdapter.java index 6aecfbbd0..6115d056f 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/notificationslist/NotificationsAdapter.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/notificationslist/NotificationsAdapter.java @@ -42,8 +42,8 @@ public class NotificationsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { private List<FieldSightNotification> fieldSightNotifications; - private OnItemClickListener<FieldSightNotification> listener; - final int TYPE_LOADING = 1, TYPE_ITEM = 2; + private final OnItemClickListener<FieldSightNotification> listener; + private static final int TYPE_LOADING = 1, TYPE_ITEM = 2; NotificationsAdapter(List<FieldSightNotification> totalList, OnItemClickListener<FieldSightNotification> listener) { this.fieldSightNotifications = totalList; @@ -70,14 +70,14 @@ public void updateList(List<FieldSightNotification> newList) { } - public FieldSightNotification getMostRecentNotification() { - if (fieldSightNotifications.size() > 0) { + FieldSightNotification getMostRecentNotification() { + if (fieldSightNotifications.size() > 0){ return fieldSightNotifications.get(0); - } else { - NotificationsAdapter + } + else{ + return null; } } - @Override public int getItemViewType(int position) { if (fieldSightNotifications.get(position) == null) { diff --git a/collect_app/src/main/java/org/fieldsight/naxa/onboarding/DownloadActivity.java b/collect_app/src/main/java/org/fieldsight/naxa/onboarding/DownloadActivity.java index d7c112736..d3f4b7dd6 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/onboarding/DownloadActivity.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/onboarding/DownloadActivity.java @@ -15,7 +15,6 @@ import androidx.recyclerview.widget.RecyclerView; import org.fieldsight.collect.android.R; -import org.fieldsight.naxa.common.Constant; import org.fieldsight.naxa.data.source.local.FieldSightNotificationLocalSource; import org.odk.collect.android.activities.CollectAbstractActivity; @@ -159,7 +158,7 @@ public ObservableSource<SyncableItem> apply(SyncableItem syncableItem) { @Override public SyncableItem apply(Integer integer) { switch (syncableItem.getUid()) { - case Constant.DownloadUID.ALL_FORMS: + case ALL_FORMS: syncableItem.setOutOfSync(integer > 0); break; } @@ -177,7 +176,7 @@ public ObservableSource<SyncableItem> apply(SyncableItem syncableItem) { @Override public SyncableItem apply(Integer integer) { switch (syncableItem.getUid()) { - case Constant.DownloadUID.PROJECT_SITES: + case PROJECT_SITES: syncableItem.setOutOfSync(integer > 0); break; } @@ -195,7 +194,7 @@ public ObservableSource<SyncableItem> apply(SyncableItem syncableItem) { @Override public SyncableItem apply(Integer integer) { switch (syncableItem.getUid()) { - case Constant.DownloadUID.PREV_SUBMISSION: + case PREV_SUBMISSION: syncableItem.setOutOfSync(integer > 0); break; } diff --git a/collect_app/src/main/java/org/fieldsight/naxa/onboarding/DownloadListAdapter.java b/collect_app/src/main/java/org/fieldsight/naxa/onboarding/DownloadListAdapter.java index 980521fec..47644ff9a 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/onboarding/DownloadListAdapter.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/onboarding/DownloadListAdapter.java @@ -124,7 +124,7 @@ public ViewHolder(View itemLayoutView) { } private void manipulateCheckedUI(SyncableItem syncableItem) { - if (syncableItem.getIsSelected()) { + if (syncableItem.isSelected()) { selectedItemCount++; } else { selectedItemCount--; diff --git a/collect_app/src/main/java/org/fieldsight/naxa/onboarding/DownloadModelImpl.java b/collect_app/src/main/java/org/fieldsight/naxa/onboarding/DownloadModelImpl.java index 01ed09a1d..afec4ffea 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/onboarding/DownloadModelImpl.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/onboarding/DownloadModelImpl.java @@ -43,10 +43,6 @@ public class DownloadModelImpl implements DownloadModel { - public DownloadModelImpl() { - - - } @Deprecated @Override diff --git a/collect_app/src/main/java/org/fieldsight/naxa/onboarding/SyncableItem.java b/collect_app/src/main/java/org/fieldsight/naxa/onboarding/SyncableItem.java index 4e9c6348d..e44939842 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/onboarding/SyncableItem.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/onboarding/SyncableItem.java @@ -72,7 +72,7 @@ public void setProgressStatus(boolean progressStatus) { this.progressStatus = progressStatus; } - public boolean getIsSelected() { + public boolean isSelected() { return isSelected; } diff --git a/collect_app/src/main/java/org/fieldsight/naxa/onboarding/XMLFormDownloadService.java b/collect_app/src/main/java/org/fieldsight/naxa/onboarding/XMLFormDownloadService.java index f532d08aa..bfb887f84 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/onboarding/XMLFormDownloadService.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/onboarding/XMLFormDownloadService.java @@ -72,7 +72,6 @@ public class XMLFormDownloadService extends IntentService implements DownloadFor private FieldSightDownloadFormListTask mDownloadFormListTask; private HashMap<String, FormDetails> mFormNamesAndURLs = new HashMap<String, FormDetails>(); - private ArrayList<HashMap<String, String>> mFormList; private LinkedList<XMLForm> formsToDownlaod; private Bundle message; @@ -163,23 +162,23 @@ public void onNext(List<Project> projects) { } for (String projectId : projectIds) { - XMLForm XMLForm; + XMLForm xmlForm; String baseurl = FieldSightUserSession.getServerUrl(Collect.getInstance()); - XMLForm = new XMLFormBuilder() + xmlForm = new XMLFormBuilder() .setFormCreatorsId(projectId) .setIsCreatedFromProject(false) .setDownloadUrl(baseurl + APIEndpoint.ASSIGNED_FORM_LIST_SITE.concat(projectId)) .createXMLForm(); - formsToDownlaod.add(XMLForm); + formsToDownlaod.add(xmlForm); - XMLForm = new XMLFormBuilder() + xmlForm = new XMLFormBuilder() .setFormCreatorsId(projectId) .setIsCreatedFromProject(true) .setDownloadUrl(baseurl + APIEndpoint.ASSIGNED_FORM_LIST_PROJECT.concat(projectId)) .createXMLForm(); - formsToDownlaod.add(XMLForm); + formsToDownlaod.add(xmlForm); } @@ -312,7 +311,7 @@ public void formListDownloadingComplete(HashMap<String, FormDetails> result) { // Everything worked. Clear the list and add the results. mFormNamesAndURLs = result; //array list added here siteName on Create - mFormList = new ArrayList<HashMap<String, String>>(); + ArrayList<HashMap<String, String>> mFormList = new ArrayList<HashMap<String, String>>(); mFormList.clear(); diff --git a/collect_app/src/main/java/org/fieldsight/naxa/preferences/SettingsSharedPreferences.java b/collect_app/src/main/java/org/fieldsight/naxa/preferences/SettingsSharedPreferences.java index edb0d710c..737e93f22 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/preferences/SettingsSharedPreferences.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/preferences/SettingsSharedPreferences.java @@ -36,7 +36,7 @@ public class SettingsSharedPreferences { private static SettingsSharedPreferences instance; - private final android.content.SharedPreferences sharedPreferences; + private final SharedPreferences sharedPreferences; private SettingsSharedPreferences() { sharedPreferences = PreferenceManager.getDefaultSharedPreferences(Collect.getInstance()); diff --git a/collect_app/src/main/java/org/fieldsight/naxa/profile/UserProfileRepository.java b/collect_app/src/main/java/org/fieldsight/naxa/profile/UserProfileRepository.java index bec073118..e0445ec71 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/profile/UserProfileRepository.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/profile/UserProfileRepository.java @@ -56,7 +56,7 @@ public Observable<User> upload(User user) { // MultipartBody.Part imageIn = MultipartBody.Part.createFormData(image.getName(), image.getName(), imageRequestBody); // userObservable = getRxClient() // .create(ApiInterface.class) -// .updateUserProfile(APIEndpoint.BASE_URL + "/users/api/profile/" + user.getUser_name() + "/", fIn, lIn, addIn, genderIn, phoneIn, skypeIn, primaryIn, secondIn, +// .updateUserProfile(APIEndpoint.BASE_URL + "/users/api/profile/" + user.getUserName() + "/", fIn, lIn, addIn, genderIn, phoneIn, skypeIn, primaryIn, secondIn, // officeIn, viberIn, whatsAppIn, wechatIn, lineIn, tangoIn, hikeIn, qqIn, googleTalkIn, twitterIn, organizationIn, imageIn); // } diff --git a/collect_app/src/main/java/org/fieldsight/naxa/project/TermsLabels.java b/collect_app/src/main/java/org/fieldsight/naxa/project/TermsLabels.java index ad82fe4cf..1df076c2c 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/project/TermsLabels.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/project/TermsLabels.java @@ -3,7 +3,7 @@ import org.json.JSONObject; public class TermsLabels { - public String region_supervisor, + public final String regionSupervisor, region, site, siteSupervisor, @@ -11,13 +11,13 @@ public class TermsLabels { regionReviewer, donor; - private TermsLabels(String region_supervisor, String region, String site, String site_supervisor, String site_reviewer, String region_reviewer, String donor) { - this.region_supervisor = region_supervisor; + private TermsLabels(String regionSupervisor, String region, String site, String siteSupervisor, String siteReviewer, String regionReviewer, String donor) { + this.regionSupervisor = regionSupervisor; this.region = region; this.site = site; - this.siteSupervisor = site_supervisor; - this.siteReviewer = site_reviewer; - this.regionReviewer = region_reviewer; + this.siteSupervisor = siteSupervisor; + this.siteReviewer = siteReviewer; + this.regionReviewer = regionReviewer; this.donor = donor; } diff --git a/collect_app/src/main/java/org/fieldsight/naxa/report/ReportActivity.java b/collect_app/src/main/java/org/fieldsight/naxa/report/ReportActivity.java index 4b76c18c7..10786fb4f 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/report/ReportActivity.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/report/ReportActivity.java @@ -151,11 +151,11 @@ void submitReport() { String appOsVersion = checkEmptyWithFallback(tvOsVersion, ""); String lat = checkEmptyWithFallback(tvLat, "0"); String lng = checkEmptyWithFallback(tvLng, "0"); - String message_type = checkEmptyWithFallback(spnrType, ""); + String messageType = checkEmptyWithFallback(spnrType, ""); String appVersion = checkEmptyWithFallback(tvAppVersion, ""); String message = checkEmptyWithFallback(edtMessage, "I have an issues using the app"); observer = ServiceGenerator.getRxClient().create(ApiInterface.class) - .submitReport(deviceId, fcmToken, appVersion, appOsVersion, message_type, message, deviceName, lat, lng) + .submitReport(deviceId, fcmToken, appVersion, appOsVersion, messageType, message, deviceName, lat, lng) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribeWith(new DisposableObserver<ResponseBody>() { diff --git a/collect_app/src/main/java/org/fieldsight/naxa/site/ProjectDashboardActivity.java b/collect_app/src/main/java/org/fieldsight/naxa/site/ProjectDashboardActivity.java index 2bfdb7bc3..86014b00a 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/site/ProjectDashboardActivity.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/site/ProjectDashboardActivity.java @@ -70,7 +70,6 @@ import org.fieldsight.naxa.v3.network.SyncActivity; import org.json.JSONObject; import org.odk.collect.android.activities.FileManagerTabs; -import org.odk.collect.android.application.Collect; import org.odk.collect.android.utilities.ApplicationConstants; import org.odk.collect.android.utilities.ToastUtils; @@ -163,10 +162,10 @@ protected void onCreate(Bundle savedInstanceState) { } private TermsLabels getTermsAndLabels() { - if(!TextUtils.isEmpty(loadedProject.getTerms_and_labels())) { + if(!TextUtils.isEmpty(loadedProject.getTermsAndLabels())) { try{ - Timber.i("ProjectDashBoardActivity:: terms and labels = %s", loadedProject.getTerms_and_labels()); - JSONObject tlJson = new JSONObject(loadedProject.getTerms_and_labels()); + Timber.i("ProjectDashBoardActivity:: terms and labels = %s", loadedProject.getTermsAndLabels()); + JSONObject tlJson = new JSONObject(loadedProject.getTermsAndLabels()); return TermsLabels.fromJSON(tlJson); }catch (Exception e){ Timber.e("Failed to load terms and labels; Reason: %s",e.getMessage()); @@ -220,7 +219,7 @@ public void onTransitionResume(Transition transition) { private void setupSearchView() { searchView.setOnClickListener(view -> { - if (Collect.allowClick(getClass().getName())) { + if (allowClick(getClass().getName())) { loadToolBarSearch(); } }); @@ -361,13 +360,13 @@ public void run() { private void handleNavDrawerClicks(int id) { switch (id) { case R.id.nav_create_offline_site: - String site_label = "Site"; - String region_label = "Region"; + String siteLabel = "Site"; + String regionLabel = "Region"; if(tl != null) { - site_label = tl.site; - region_label = tl.region; + siteLabel = tl.site; + regionLabel = tl.region; } - CreateSiteActivity.start(this, loadedProject, null, site_label, region_label); + CreateSiteActivity.start(this, loadedProject, null, siteLabel, regionLabel); break; case R.id.nav_delete_saved_form: diff --git a/collect_app/src/main/java/org/fieldsight/naxa/site/SiteClusterSpinnerAdapter.java b/collect_app/src/main/java/org/fieldsight/naxa/site/SiteClusterSpinnerAdapter.java index 19b591061..0709e7cd7 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/site/SiteClusterSpinnerAdapter.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/site/SiteClusterSpinnerAdapter.java @@ -36,8 +36,7 @@ public class SiteClusterSpinnerAdapter extends ArrayAdapter<Region> { public int getCount() { int count = super.getCount(); - int newCount = count > 0 ? count - 1 : count; - return newCount; + return count > 0 ? count - 1 : count; } diff --git a/collect_app/src/main/java/org/fieldsight/naxa/site/SiteDashboardFragment.java b/collect_app/src/main/java/org/fieldsight/naxa/site/SiteDashboardFragment.java index 8fecfa097..c481b62ce 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/site/SiteDashboardFragment.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/site/SiteDashboardFragment.java @@ -96,10 +96,6 @@ public class SiteDashboardFragment extends Fragment implements View.OnClickListe boolean isParent ; - public SiteDashboardFragment() { - - } - public static SiteDashboardFragment newInstance(Site site, boolean isParent) { SiteDashboardFragment fragment = new SiteDashboardFragment(); diff --git a/collect_app/src/main/java/org/fieldsight/naxa/site/SiteListFragment.java b/collect_app/src/main/java/org/fieldsight/naxa/site/SiteListFragment.java index 264e1a90f..ef306ac20 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/site/SiteListFragment.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/site/SiteListFragment.java @@ -145,10 +145,10 @@ private TermsLabels getTermsAndLabels() { if (loadedProject == null) { return null; } - if (!TextUtils.isEmpty(loadedProject.getTerms_and_labels())) { + if (!TextUtils.isEmpty(loadedProject.getTermsAndLabels())) { try { - Timber.i("ProjectDashBoardActivity:: terms and labels = %s", loadedProject.getTerms_and_labels()); - JSONObject tlJson = new JSONObject(loadedProject.getTerms_and_labels()); + Timber.i("ProjectDashBoardActivity:: terms and labels = %s", loadedProject.getTermsAndLabels()); + JSONObject tlJson = new JSONObject(loadedProject.getTermsAndLabels()); return TermsLabels.fromJSON(tlJson); } catch (Exception e) { Timber.e(e); diff --git a/collect_app/src/main/java/org/fieldsight/naxa/site/SiteTypeSpinnerAdapter.java b/collect_app/src/main/java/org/fieldsight/naxa/site/SiteTypeSpinnerAdapter.java index 1d44e3954..3ad521bbc 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/site/SiteTypeSpinnerAdapter.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/site/SiteTypeSpinnerAdapter.java @@ -40,8 +40,7 @@ public List<SiteType> getValues(){ public int getCount() { int count = super.getCount(); - int newCount = count > 0 ? count - 1 : count; - return newCount; + return count > 0 ? count - 1 : count; } diff --git a/collect_app/src/main/java/org/fieldsight/naxa/site/db/SiteLocalSource.java b/collect_app/src/main/java/org/fieldsight/naxa/site/db/SiteLocalSource.java index 00a891a94..89dd10405 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/site/db/SiteLocalSource.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/site/db/SiteLocalSource.java @@ -25,7 +25,7 @@ public class SiteLocalSource implements BaseLocalDataSource<Site> { - private static SiteLocalSource INSTANCE; + private static SiteLocalSource siteLocalSource; private final SiteDao dao; @@ -36,10 +36,10 @@ private SiteLocalSource() { public synchronized static SiteLocalSource getInstance() { - if (INSTANCE == null) { - INSTANCE = new SiteLocalSource(); + if (siteLocalSource == null) { + siteLocalSource = new SiteLocalSource(); } - return INSTANCE; + return siteLocalSource; } diff --git a/collect_app/src/main/java/org/fieldsight/naxa/site/db/SiteRemoteSource.java b/collect_app/src/main/java/org/fieldsight/naxa/site/db/SiteRemoteSource.java index f70f1c286..009656f78 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/site/db/SiteRemoteSource.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/site/db/SiteRemoteSource.java @@ -1,22 +1,20 @@ package org.fieldsight.naxa.site.db; import org.fieldsight.collect.android.R; -import org.odk.collect.android.application.Collect; import org.fieldsight.naxa.common.BaseRemoteDataSource; -import org.fieldsight.naxa.common.Constant; +import org.fieldsight.naxa.common.DisposableManager; import org.fieldsight.naxa.common.FieldSightNotificationUtils; import org.fieldsight.naxa.common.database.SiteUploadHistory; import org.fieldsight.naxa.common.rx.RetrofitException; +import org.fieldsight.naxa.helpers.FSInstancesDao; import org.fieldsight.naxa.login.model.Site; import org.fieldsight.naxa.network.APIEndpoint; import org.fieldsight.naxa.network.ApiInterface; -import org.fieldsight.naxa.common.DisposableManager; -import org.fieldsight.naxa.network.ServiceGenerator; import org.fieldsight.naxa.sync.DownloadableItemLocalSource; import org.fieldsight.naxa.sync.SyncRepository; import org.fieldsight.naxa.v3.network.ApiV3Interface; import org.fieldsight.naxa.v3.network.SiteResponse; -import org.fieldsight.naxa.helpers.FSInstancesDao; +import org.odk.collect.android.application.Collect; import org.odk.collect.android.utilities.FileUtils; import java.io.File; @@ -37,7 +35,6 @@ import static org.fieldsight.naxa.common.Constant.DownloadUID.EDITED_SITES; import static org.fieldsight.naxa.common.Constant.DownloadUID.OFFLINE_SITES; - import static org.fieldsight.naxa.common.Constant.SiteStatus.IS_EDITED; import static org.fieldsight.naxa.common.Constant.SiteStatus.IS_OFFLINE; import static org.fieldsight.naxa.common.Constant.SiteStatus.IS_ONLINE; @@ -45,14 +42,14 @@ public class SiteRemoteSource implements BaseRemoteDataSource<Site> { - private static SiteRemoteSource INSTANCE; + private static SiteRemoteSource siteRemoteSource; public synchronized static SiteRemoteSource getInstance() { - if (INSTANCE == null) { - INSTANCE = new SiteRemoteSource(); + if (siteRemoteSource == null) { + siteRemoteSource = new SiteRemoteSource(); } - return INSTANCE; + return siteRemoteSource; } @@ -119,7 +116,7 @@ public void onError(Throwable e) { public void uploadAllOfflineSite() { DisposableSingleObserver<List<Site>> dis = SiteLocalSource.getInstance() - .getAllByStatus(Constant.SiteStatus.IS_OFFLINE) + .getAllByStatus(IS_OFFLINE) .doOnDispose(() -> DownloadableItemLocalSource.getDownloadableItemLocalSource().markAsFailed(OFFLINE_SITES)) .doOnSubscribe(disposable -> { SyncRepository.getInstance().showProgress(OFFLINE_SITES); @@ -290,14 +287,14 @@ public Single<SiteResponse> getSitesByRegionId(String regionId) { } public Single<SiteResponse> getSitesByURL(String url) { - return ServiceGenerator.getRxClient() + return getRxClient() .create(ApiV3Interface.class) .getSites(url) .subscribeOn(Schedulers.io()); } public Single<SiteResponse> getSites(HashMap<String, String> params) { - return ServiceGenerator.getRxClient() + return getRxClient() .create(ApiV3Interface.class) .getSites(params) .subscribeOn(Schedulers.io()); diff --git a/collect_app/src/main/java/org/fieldsight/naxa/stages/StageListFragment.java b/collect_app/src/main/java/org/fieldsight/naxa/stages/StageListFragment.java index c01b232d6..b996bbd3c 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/stages/StageListFragment.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/stages/StageListFragment.java @@ -67,9 +67,6 @@ public static StageListFragment newInstance(@NonNull Site loadedSite) { } - public StageListFragment() { - - } @Override public void onCreate(@Nullable Bundle savedInstanceState) { diff --git a/collect_app/src/main/java/org/fieldsight/naxa/stages/data/SubStage.java b/collect_app/src/main/java/org/fieldsight/naxa/stages/data/SubStage.java index b2cf26e47..ca900ba1d 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/stages/data/SubStage.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/stages/data/SubStage.java @@ -85,7 +85,7 @@ public class SubStage implements Parcelable { @Ignore @SerializedName("latest_submission") @Expose - private List<FormResponse> latestSubmission ; + private List<FormResponse> latestSubmission; private String lastSubmissionBy; private String lastSubmissionDateTime; @@ -118,7 +118,6 @@ public SubStage(Integer id, StageForms stageForms, String name, String descripti } - public String getFsFormId() { return fsFormId; } @@ -233,8 +232,12 @@ public void setLastSubmissionBy(String lastSubmissionBy) { @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } SubStage subStage = (SubStage) o; return Objects.equal(id, subStage.id) && Objects.equal(stageId, subStage.stageId) && diff --git a/collect_app/src/main/java/org/fieldsight/naxa/substages/SubStageListAdapter.java b/collect_app/src/main/java/org/fieldsight/naxa/substages/SubStageListAdapter.java index 1045698e1..3ec8c57c0 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/substages/SubStageListAdapter.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/substages/SubStageListAdapter.java @@ -138,7 +138,9 @@ private Drawable getCircleDrawableBackground(String status) { Drawable drawable = ContextCompat.getDrawable(Collect.getInstance().getApplicationContext(), R.drawable.circle_blue); - if (status == null) return drawable; + if (status == null) { + return drawable; + } switch (status) { case Constant.FormStatus.APPROVED: drawable = ContextCompat.getDrawable(Collect.getInstance().getApplicationContext(), R.drawable.circle_green); diff --git a/collect_app/src/main/java/org/fieldsight/naxa/substages/SubStageListFragment.java b/collect_app/src/main/java/org/fieldsight/naxa/substages/SubStageListFragment.java index 68e490785..da0750e96 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/substages/SubStageListFragment.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/substages/SubStageListFragment.java @@ -110,10 +110,6 @@ public static SubStageListFragment newInstance(Site loadedSite, List<SubStage> s } - public SubStageListFragment() { - - } - @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); diff --git a/collect_app/src/main/java/org/fieldsight/naxa/survey/SurveyFormsActivity.java b/collect_app/src/main/java/org/fieldsight/naxa/survey/SurveyFormsActivity.java index ed1d9b06b..8d6fed24f 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/survey/SurveyFormsActivity.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/survey/SurveyFormsActivity.java @@ -87,7 +87,9 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { new Observer<List<SurveyForm>>() { @Override public void onChanged(@Nullable List<SurveyForm> surveyForms) { - if (surveyForms == null) return; + if (surveyForms == null){ + return; + } adapter.clear(); adapter.addAll(surveyForms); diff --git a/collect_app/src/main/java/org/fieldsight/naxa/sync/DownloadViewModel.java b/collect_app/src/main/java/org/fieldsight/naxa/sync/DownloadViewModel.java index 5116ed38e..1bd611c8d 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/sync/DownloadViewModel.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/sync/DownloadViewModel.java @@ -245,7 +245,7 @@ public void fetchODKForms() { case DownloadProgress.STATUS_PROGRESS_UPDATE: DownloadProgress progress = (DownloadProgress) resultData.getSerializable(EXTRA_OBJECT); Timber.i(progress.getMessage()); - DownloadableItemLocalSource.getDownloadableItemLocalSource().updateProgress(Constant.DownloadUID.ALL_FORMS, progress.getTotal(), progress.getProgress()); + DownloadableItemLocalSource.getDownloadableItemLocalSource().updateProgress(ALL_FORMS, progress.getTotal(), progress.getProgress()); break; case DownloadProgress.STATUS_ERROR: EventBus.getDefault().post(new DataSyncEvent(uid, EVENT_ERROR)); diff --git a/collect_app/src/main/java/org/fieldsight/naxa/sync/DownloadableItem.java b/collect_app/src/main/java/org/fieldsight/naxa/sync/DownloadableItem.java index f0807ba28..8b1ff0cef 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/sync/DownloadableItem.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/sync/DownloadableItem.java @@ -91,7 +91,7 @@ public void setChecked(boolean checked) { } - public boolean getIsSelected() { + public boolean isSelected() { return isSelected; } diff --git a/collect_app/src/main/java/org/fieldsight/naxa/sync/DownloadableItemLocalSource.java b/collect_app/src/main/java/org/fieldsight/naxa/sync/DownloadableItemLocalSource.java index 30879a229..e35f1a90f 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/sync/DownloadableItemLocalSource.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/sync/DownloadableItemLocalSource.java @@ -20,6 +20,8 @@ import io.reactivex.Completable; import io.reactivex.Single; +import static org.fieldsight.naxa.common.Constant.DownloadStatus.COMPLETED; +import static org.fieldsight.naxa.common.Constant.DownloadStatus.DISABLED; import static org.fieldsight.naxa.common.Constant.DownloadStatus.PENDING; import static org.fieldsight.naxa.common.Constant.DownloadUID.EDITED_SITES; import static org.fieldsight.naxa.common.Constant.DownloadUID.ODK_FORMS; @@ -144,7 +146,7 @@ public void run() { } public void markAsDisabled(int uid, String message) { - AsyncTask.execute(() -> syncDAO.markSelectedAsDisabled(uid, Constant.DownloadStatus.DISABLED, formattedDate(), message)); + AsyncTask.execute(() -> syncDAO.markSelectedAsDisabled(uid, DISABLED, formattedDate(), message)); } @@ -180,7 +182,7 @@ public void markAsPending(int uid) { AsyncTask.execute(new Runnable() { @Override public void run() { - syncDAO.markSelectedAsRunning(uid, Constant.DownloadStatus.PENDING); + syncDAO.markSelectedAsRunning(uid, PENDING); } }); @@ -190,7 +192,7 @@ public void markAsPending(int uid, String message) { AsyncTask.execute(new Runnable() { @Override public void run() { - syncDAO.markSelectedAsDisabled(uid, Constant.DownloadStatus.PENDING, formattedDate(), message); + syncDAO.markSelectedAsDisabled(uid, PENDING, formattedDate(), message); } }); @@ -199,13 +201,13 @@ public void run() { public void markAllAsPending() { AsyncTask.execute(() -> { - syncDAO.markAllAsPending(PENDING, Constant.DownloadStatus.DISABLED); + syncDAO.markAllAsPending(PENDING, DISABLED); }); } public void markAsCompleted(int uid) { AsyncTask.execute(() -> { - syncDAO.markSelectedAsCompleted(uid, Constant.DownloadStatus.COMPLETED, formattedDate()); + syncDAO.markSelectedAsCompleted(uid, COMPLETED, formattedDate()); clearErrorMessage(uid); }); } @@ -217,8 +219,7 @@ public void updateProgress(int uid, int total, int progress) { private String formattedDate() { Date date = Calendar.getInstance().getTime(); SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd, hh:mm aa", Locale.US); - String formattedDate = df.format(date); - return formattedDate; + return df.format(date); } diff --git a/collect_app/src/main/java/org/fieldsight/naxa/sync/SyncRepository.java b/collect_app/src/main/java/org/fieldsight/naxa/sync/SyncRepository.java index 791cd3d15..1e86646e6 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/sync/SyncRepository.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/sync/SyncRepository.java @@ -94,8 +94,7 @@ private void updateDate(int uid) { public String formattedDate() { Date date = Calendar.getInstance().getTime(); SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd, hh:mm aa", Locale.US); - String formattedDate = df.format(date); - return formattedDate; + return df.format(date); } public Single<SyncableItem> getStatusById(int uid) { diff --git a/collect_app/src/main/java/org/fieldsight/naxa/v3/adapter/SyncAdapterv3.java b/collect_app/src/main/java/org/fieldsight/naxa/v3/adapter/SyncAdapterv3.java index b8d453d82..7bbed2dd4 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/v3/adapter/SyncAdapterv3.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/v3/adapter/SyncAdapterv3.java @@ -112,7 +112,7 @@ private void notifyProgressBar() { int totalSynced = 0; int totalSize = 0; for (Syncable syncable : syncableList) { - if (!syncable.getSync()) { + if (!syncable.isSync()) { continue; } if (syncable.getStatus() == Constant.DownloadStatus.COMPLETED) { @@ -157,7 +157,7 @@ public void onBindViewHolder(@NonNull SyncViewHolder syncViewHolder, int i) { syncViewHolder.bindView(project, progressMap, disableItemClick); List<Syncable> syncables = syncableMap.get(project.getId()); syncViewHolder.manageChildView(syncables, disableItemClick); - syncViewHolder.iv_cancel.setOnClickListener(v -> { + syncViewHolder.ivCancel.setOnClickListener(v -> { if (callback != null) { callback.onRequestInterrupt(i, project); } diff --git a/collect_app/src/main/java/org/fieldsight/naxa/v3/adapter/SyncViewHolder.java b/collect_app/src/main/java/org/fieldsight/naxa/v3/adapter/SyncViewHolder.java index c7de58584..e45769475 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/v3/adapter/SyncViewHolder.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/v3/adapter/SyncViewHolder.java @@ -37,25 +37,25 @@ public class SyncViewHolder extends RecyclerView.ViewHolder { @BindView(R.id.tv_project_name) - TextView tv_project_name; + TextView tvProjectName; @BindView(R.id.tv_project_other) - TextView tv_project_other; + TextView tvProjectOther; @BindView(R.id.iv_cancel) - ImageView iv_cancel; + ImageView ivCancel; @BindView(R.id.progress_bar) ProgressBar progressBar; @BindView(R.id.lv_options) - ListView lv_options; + ListView lvOptions; @BindView(R.id.iv_avatar) - ImageView iv_avatar; + ImageView ivAvatar; @BindView(R.id.tv_project_progress_percentage) - TextView tv_project_progress_percentage; + TextView tvProjectProgressPercentage; private Project project; @@ -68,23 +68,23 @@ public class SyncViewHolder extends RecyclerView.ViewHolder { void bindView(Project project, HashMap<String, Integer> progressMap, boolean disable) { this.project = project; - tv_project_name.setText(project.getName()); - tv_project_other.setText(String.format("By %s", project.getOrganizationName())); + tvProjectName.setText(project.getName()); + tvProjectOther.setText(String.format("By %s", project.getOrganizationName())); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { progressBar.setProgress(progressMap.get(project.getId()), true); } else { progressBar.setProgress(progressMap.get(project.getId())); } - iv_cancel.setVisibility(disable ? View.GONE : View.VISIBLE); - tv_project_progress_percentage.setText(progressMap.get(project.getId()) + "%"); + ivCancel.setVisibility(disable ? View.GONE : View.VISIBLE); + tvProjectProgressPercentage.setText(progressMap.get(project.getId()) + "%"); Timber.i("SyncViewHolder, projectImage = %s", project.getUrl()); Glide.with(itemView.getContext()).load(project.getUrl()). - apply(RequestOptions.circleCropTransform()).into(iv_avatar); + apply(RequestOptions.circleCropTransform()).into(ivAvatar); } void manageChildView(List<Syncable> syncableList, boolean disable) { Timber.i("SyncViewHolder, syncablelistsize = %d", syncableList.size()); - lv_options.setAdapter(new ArrayAdapter<Syncable>(itemView.getContext(), R.layout.row_text_checkbox_v2, syncableList) { + lvOptions.setAdapter(new ArrayAdapter<Syncable>(itemView.getContext(), R.layout.row_text_checkbox_v2, syncableList) { @NonNull @Override public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) { @@ -93,7 +93,7 @@ public View getView(int position, @Nullable View convertView, @NonNull ViewGroup } Syncable syncable = getItem(position); CheckBox chkbx = convertView.findViewById(R.id.chkbx_sync_select); - chkbx.setChecked(syncable.getSync()); + chkbx.setChecked(syncable.isSync()); ((TextView) convertView.findViewById(R.id.tv_name)).setText(syncable.getTitle()); convertView.setOnClickListener(v -> { Timber.i("SyncViewHolder clicked"); diff --git a/collect_app/src/main/java/org/fieldsight/naxa/v3/forms/FieldSightFormDownloader.java b/collect_app/src/main/java/org/fieldsight/naxa/v3/forms/FieldSightFormDownloader.java index 1f9bb8b55..da3bb0cfe 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/v3/forms/FieldSightFormDownloader.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/v3/forms/FieldSightFormDownloader.java @@ -73,7 +73,7 @@ public Pair<FieldsightFormDetailsv3, String> downloadSingleFieldSightForm(Fields try { message = processOneForm(1, 1, fd); pair = Pair.create(fieldsightFormDetailsv3, message); - Timber.d("form downloading starts for PROJECT = " + fieldsightFormDetailsv3.getSite_project_id() + " or " + fieldsightFormDetailsv3.getProject() + " for = " + fd.getFormName()); + Timber.d("form downloading starts for PROJECT = " + fieldsightFormDetailsv3.getSiteProjectId() + " or " + fieldsightFormDetailsv3.getProject() + " for = " + fd.getFormName()); } catch (TaskCancelledException e) { Timber.e(e); pair = Pair.create(fieldsightFormDetailsv3, "Failed to create form download request"); diff --git a/collect_app/src/main/java/org/fieldsight/naxa/v3/network/ProjectBuilder.java b/collect_app/src/main/java/org/fieldsight/naxa/v3/network/ProjectBuilder.java index d619b675a..a766075be 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/v3/network/ProjectBuilder.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/v3/network/ProjectBuilder.java @@ -116,8 +116,8 @@ public ProjectBuilder setIn(Parcel in) { this.in = in; return this; } - public ProjectBuilder setTermsAndLabels(String terms_and_labels) { - this.termsAndLabels = terms_and_labels; + public ProjectBuilder setTermsAndLabels(String termsAndLabels) { + this.termsAndLabels = termsAndLabels; return this; } diff --git a/collect_app/src/main/java/org/fieldsight/naxa/v3/network/SyncActivity.java b/collect_app/src/main/java/org/fieldsight/naxa/v3/network/SyncActivity.java index aafba55a6..02426d8f1 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/v3/network/SyncActivity.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/v3/network/SyncActivity.java @@ -226,7 +226,7 @@ private void enableDisableAdapter(boolean isSyncing) { private String readaableSyncParams(String projectName, List<Syncable> list) { String logString = ""; for (Syncable syncable : list) { - logString += "\n title = " + syncable.getTitle() + ", sync = " + syncable.getSync(); + logString += "\n title = " + syncable.getTitle() + ", sync = " + syncable.isSync(); } return String.format("%s \n params = %s", projectName, logString); } diff --git a/collect_app/src/main/java/org/fieldsight/naxa/v3/network/SyncServiceV3.java b/collect_app/src/main/java/org/fieldsight/naxa/v3/network/SyncServiceV3.java index b221b3d6e..cee182d2d 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/v3/network/SyncServiceV3.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/v3/network/SyncServiceV3.java @@ -445,14 +445,14 @@ public ObservableSource<? extends SiteResponse> apply(SiteResponse siteResponse) } private String getProjectId(FieldsightFormDetailsv3 fd) { - return TextUtils.isEmpty(fd.getProject()) || TextUtils.equals(fd.getProject(), "null") ? fd.getSite_project_id() : fd.getProject(); + return TextUtils.isEmpty(fd.getProject()) || TextUtils.equals(fd.getProject(), "null") ? fd.getSiteProjectId() : fd.getProject(); } private String readaableSyncParams(String projectName, List<Syncable> list) { String logString = ""; for (Syncable syncable : list) { - logString += "\n title = " + syncable.getTitle() + ", sync = " + syncable.getSync(); + logString += "\n title = " + syncable.getTitle() + ", sync = " + syncable.isSync(); } return String.format("%s \n params = %s", projectName, logString); } diff --git a/collect_app/src/main/java/org/fieldsight/naxa/v3/network/SyncStat.java b/collect_app/src/main/java/org/fieldsight/naxa/v3/network/SyncStat.java index 637804128..6f3c5ce1d 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/v3/network/SyncStat.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/v3/network/SyncStat.java @@ -46,13 +46,13 @@ public class SyncStat { @params started */ @Ignore - public SyncStat(@NotNull String projectId, @NotNull String type, String failedUrl, boolean started, int status, long created_date) { + public SyncStat(@NotNull String projectId, @NotNull String type, String failedUrl, boolean started, int status, long createdDate) { this.projectId = projectId; this.type = type; this.failedUrl = failedUrl; this.started = started; this.status = status; - this.createdDate = created_date; + this.createdDate = createdDate; } public void setProgress(int progress) { diff --git a/collect_app/src/main/java/org/fieldsight/naxa/v3/network/Syncable.java b/collect_app/src/main/java/org/fieldsight/naxa/v3/network/Syncable.java index 5f09daac6..040f2ca9b 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/v3/network/Syncable.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/v3/network/Syncable.java @@ -56,7 +56,7 @@ public void setSync(boolean sync) { this.sync = sync; } - public boolean getSync() { + public boolean isSync() { return this.sync; } diff --git a/collect_app/src/main/java/org/odk/collect/android/SiteProfileActivity.java b/collect_app/src/main/java/org/odk/collect/android/SiteProfileActivity.java index 71e3da8ff..fcfd07369 100644 --- a/collect_app/src/main/java/org/odk/collect/android/SiteProfileActivity.java +++ b/collect_app/src/main/java/org/odk/collect/android/SiteProfileActivity.java @@ -327,30 +327,30 @@ public void onViewClicked() { ProjectLocalSource.getInstance() .getProjectById(loadedSite.getProject()) - .observe(this, project -> { - if (project == null) { + .observe(this, termsAndLabels -> { + if (termsAndLabels == null) { ToastUtils.showLongToast(getString(R.string.dialog_unexpected_error_title)); return; } - String site_label = "Site", region_label = "Region"; - if (!TextUtils.equals("null", project.getTerms_and_labels())) { + String siteLabel = "Site", regionLabel = "Region"; + if (!TextUtils.equals("null", termsAndLabels.getTermsAndLabels())) { TermsLabels tl; Timber.i("null siteProfileActivity"); try { - tl = TermsLabels.fromJSON(new JSONObject(project.getTerms_and_labels())); + tl = TermsLabels.fromJSON(new JSONObject(termsAndLabels.getTermsAndLabels())); if (!TextUtils.isEmpty(tl.site)) { - site_label = tl.site; + siteLabel = tl.site; } if (!TextUtils.isEmpty(tl.region)) { - region_label = tl.region; + regionLabel = tl.region; } } catch (JSONException e) { Timber.e(e); } } - CreateSiteActivity.start(this, project, loadedSite, site_label, region_label); + CreateSiteActivity.start(this, termsAndLabels, loadedSite, siteLabel, regionLabel); }); diff --git a/collect_app/src/main/java/org/odk/collect/android/application/Collect.java b/collect_app/src/main/java/org/odk/collect/android/application/Collect.java index b702376f5..58ffaf1b5 100644 --- a/collect_app/src/main/java/org/odk/collect/android/application/Collect.java +++ b/collect_app/src/main/java/org/odk/collect/android/application/Collect.java @@ -329,7 +329,7 @@ protected void setupOSMDroid() { private void setupCrashlytics() { try { String email = FieldSightUserSession.getUser().getEmail(); - String username = FieldSightUserSession.getUser().getUser_name(); + String username = FieldSightUserSession.getUser().getUserName(); Crashlytics.setString("email", email); Crashlytics.setString("username", username); Crashlytics.setUserEmail(email); diff --git a/collect_app/src/main/java/org/odk/collect/android/utilities/FileUtils.java b/collect_app/src/main/java/org/odk/collect/android/utilities/FileUtils.java index e89fe7441..9dfc21e12 100644 --- a/collect_app/src/main/java/org/odk/collect/android/utilities/FileUtils.java +++ b/collect_app/src/main/java/org/odk/collect/android/utilities/FileUtils.java @@ -708,7 +708,9 @@ private static boolean copyOrMoveDir(final File srcDir, // destDir's path locate in srcDir's path then return false String srcPath = srcDir.getPath() + File.separator; String destPath = destDir.getPath() + File.separator; - if (destPath.contains(srcPath)) return false; + if (destPath.contains(srcPath)) { + return false; + } if (!srcDir.exists() || !srcDir.isDirectory()) { return false; } diff --git a/config/pmd-ruleset.xml b/config/pmd-ruleset.xml index 877657381..58c115603 100644 --- a/config/pmd-ruleset.xml +++ b/config/pmd-ruleset.xml @@ -32,30 +32,30 @@ <exclude name="OneDeclarationPerLine" /> </rule> -<!-- <rule ref="category/java/codestyle.xml">--> -<!-- <exclude name="AtLeastOneConstructor" />--> -<!-- <exclude name="AvoidFinalLocalVariable" />--> -<!-- <exclude name="AvoidPrefixingMethodParameters" />--> -<!-- <exclude name="AvoidProtectedMethodInFinalClassNotExtending" />--> -<!-- <exclude name="CallSuperInConstructor" />--> -<!-- <exclude name="ClassNamingConventions" />--> -<!-- <exclude name="CommentDefaultAccessModifier" />--> -<!-- <exclude name="ConfusingTernary" />--> -<!-- <exclude name="DefaultPackage" />--> -<!-- <exclude name="FieldDeclarationsShouldBeAtStartOfClass" />--> -<!-- <exclude name="LongVariable" />--> -<!-- <exclude name="LocalVariableCouldBeFinal" />--> -<!-- <exclude name="MIsLeadingVariableName" />--> -<!-- <exclude name="MethodArgumentCouldBeFinal" />--> -<!-- <exclude name="MethodNamingConventions" />--> -<!-- <exclude name="OnlyOneReturn" />--> -<!-- <exclude name="PrematureDeclaration" />--> -<!-- <exclude name="ShortClassName" />--> -<!-- <exclude name="ShortMethodName" />--> -<!-- <exclude name="ShortVariable" />--> -<!-- <exclude name="TooManyStaticImports" />--> -<!-- <exclude name="UselessParentheses" /> <!– Decided not to use in #1519 –>--> -<!-- </rule>--> + <rule ref="category/java/codestyle.xml"> + <exclude name="AtLeastOneConstructor" /> + <exclude name="AvoidFinalLocalVariable" /> + <exclude name="AvoidPrefixingMethodParameters" /> + <exclude name="AvoidProtectedMethodInFinalClassNotExtending" /> + <exclude name="CallSuperInConstructor" /> + <exclude name="ClassNamingConventions" /> + <exclude name="CommentDefaultAccessModifier" /> + <exclude name="ConfusingTernary" /> + <exclude name="DefaultPackage" /> + <exclude name="FieldDeclarationsShouldBeAtStartOfClass" /> + <exclude name="LongVariable" /> + <exclude name="LocalVariableCouldBeFinal" /> + <exclude name="MIsLeadingVariableName" /> + <exclude name="MethodArgumentCouldBeFinal" /> + <exclude name="MethodNamingConventions" /> + <exclude name="OnlyOneReturn" /> + <exclude name="PrematureDeclaration" /> + <exclude name="ShortClassName" /> + <exclude name="ShortMethodName" /> + <exclude name="ShortVariable" /> + <exclude name="TooManyStaticImports" /> + <exclude name="UselessParentheses" /> <!-- Decided not to use in #1519 --> + </rule> <rule ref="category/java/design.xml"> <exclude name="AvoidCatchingGenericException" />