Skip to content
This repository has been archived by the owner on Feb 8, 2022. It is now read-only.

Commit

Permalink
Removes unused imports (#403)
Browse files Browse the repository at this point in the history
  • Loading branch information
konishon committed Oct 15, 2019
1 parent dd36267 commit 34d19f9
Show file tree
Hide file tree
Showing 55 changed files with 166 additions and 143 deletions.
2 changes: 1 addition & 1 deletion collect_app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ configurations.all {
force('com.google.code.findbugs:jsr305:1.3.9')

//todo: identify and fix this conflict
//Conflict with dependency 'org.objenesis:objenesis' in project ':collect_app'. Resolved versions for app (2.4) and test app (2.6) differ.
//Conflict with dependency 'org.objenesis:objenesis' in PROJECT ':collect_app'. Resolved versions for app (2.4) and test app (2.6) differ.
force 'org.objenesis:objenesis:2.1'
}
transitive = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public static final class FormType {
}

public final static class FormDeploymentFrom {
public final static String PROJECT = "project";
public final static String PROJECT = "PROJECT";
public final static String SITE = "site";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ public static void removeFromPrefs(Context context, String key) {
}

public static String keySelectedRegionId(String projectId) {
return String.format("project-id-%s", projectId);
return String.format("PROJECT-id-%s", projectId);
}

public static String keySelectedRegionLabel(String label) {
return String.format("project-label-%s", label);
return String.format("PROJECT-label-%s", label);
}

public static String getSiteLisTitle(Context context, String projectId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,8 @@ public FieldSightNotification parseNotificationData(JSONObject jsonObject) {

}
}
if (notificationData.has("project")) {
String site = notificationData.optString("project");
if (notificationData.has("PROJECT")) {
String site = notificationData.optString("PROJECT");
try {
JSONObject siteData = new JSONObject(site);
if (siteData.has("name")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ private Observable<String> getProjectObservable(@Nullable String projectId) {
@Override
public List<Project> apply(List<Project> projects) throws Exception {
if (projects.isEmpty()) {
throw new RuntimeException("Download project(s) site(s) first");
throw new RuntimeException("Download PROJECT(s) site(s) first");
}
return projects;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ private void parseNotificationData(Map<String, String> notificationData) {

}
}
if (notificationData.containsKey("project")) {
String site = notificationData.get("project");
if (notificationData.containsKey("PROJECT")) {
String site = notificationData.get("PROJECT");
try {
JSONObject siteData = new JSONObject(site);
if (siteData.has("name")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class FieldSightFormDetails extends FormDetails {
@SerializedName("site")
private String formDeployedSiteId;

@SerializedName("project")
@SerializedName("PROJECT")
private String formDeployedProjectId;

@SerializedName("site_project_id")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class FieldsightFormDetailsv3 {
@ColumnInfo(name = "site")
String site;

@ColumnInfo(name = "project")
@ColumnInfo(name = "PROJECT")
String project;

@ColumnInfo(name = "site_project_id")
Expand Down Expand Up @@ -154,7 +154,7 @@ public static FieldsightFormDetailsv3 parseFromJSON(JSONObject jsonObject, Strin
FieldsightFormDetailsv3 fieldsightFormDetailsv3 = new FieldsightFormDetailsv3();
FormDetails formDetails = formDetailsfromJSON(jsonObject);
fieldsightFormDetailsv3.setId(jsonObject.optString("id"));
fieldsightFormDetailsv3.setProject(jsonObject.optString("project"));
fieldsightFormDetailsv3.setProject(jsonObject.optString("PROJECT"));
fieldsightFormDetailsv3.setSite_project_id(jsonObject.optString("site_project_id"));
fieldsightFormDetailsv3.setSite(jsonObject.optString("site"));
fieldsightFormDetailsv3.setFormDetails(formDetailsfromJSON(jsonObject));
Expand Down Expand Up @@ -218,7 +218,7 @@ public static List<FieldsightFormDetailsv3> fieldsightFormDetailsV3FromJSON(JSON

JSONObject subStageFormDetailJSON = subStageFormJSON.optJSONObject("stage_forms");
fieldsightFormDetails.setId(subStageFormDetailJSON.optString("id"));
fieldsightFormDetails.setProject(subStageFormDetailJSON.optString("project"));
fieldsightFormDetails.setProject(subStageFormDetailJSON.optString("PROJECT"));
fieldsightFormDetails.setSite_project_id(subStageFormDetailJSON.optString("site_project_id"));
fieldsightFormDetails.setSite(subStageFormDetailJSON.optString("site"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ private void updateProjectIdUrlMap(FieldsightFormDetailsv3 fieldsightFormDetails
}
private Integer getProjectId(FieldsightFormDetailsv3 fieldSightForm) {
String value = TextUtils.isEmpty(fieldSightForm.getProject()) || TextUtils.equals(fieldSightForm.getProject(), "null")? fieldSightForm.getSite_project_id() : fieldSightForm.getProject();
Timber.i("Fieldsightformremotesourcev3, id = %s, value = %s, projectName = %s, project = %s, site_project_id = %s",
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());
return Integer.parseInt(value);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class FormResponse implements Parcelable {
@SerializedName("site")
@Expose
private Integer site;
@SerializedName("project")
@SerializedName("PROJECT")
@Expose
private Integer project;
@SerializedName("site_fxf")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public class GeneralForm {
@SerializedName("site")
@Expose
private String siteId;
@SerializedName(value = "project")
@SerializedName(value = "PROJECT")
@Expose
private String projectId;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ public static String generateSubmissionUrl(String formDeployedFrom, String siteI

switch (formDeployedFrom) {
case PROJECT:
submissionUrl += "project/" + fsFormId + "/" + siteId;
submissionUrl += "PROJECT/" + fsFormId + "/" + siteId;
break;
case SITE:
submissionUrl += fsFormId + "/" + siteId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
public class MySites {


@SerializedName("project")
@SerializedName("PROJECT")
@Expose(serialize = false,deserialize = false)
private Project project;
@SerializedName("site")
Expand All @@ -17,7 +17,7 @@ public class MySites {
/**
*
* @return
* The project
* The PROJECT
*/
public Project getProject() {
return project;
Expand All @@ -26,7 +26,7 @@ public Project getProject() {
/**
*
* @param project
* The project
* The PROJECT
*/
public void setProject(Project project) {
this.project = project;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
/**
* Created by Susan on 11/24/2016.
*/
@Entity(tableName = "project")
@Entity(tableName = "PROJECT")
public class Project implements Parcelable {

@PrimaryKey
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public class Site implements Parcelable {
@ColumnInfo(name = "dateCreated")
private String dateCreated;

@ColumnInfo(name = "project")
@ColumnInfo(name = "PROJECT")
private String project;

@ColumnInfo(name = "isSiteVerified")
Expand Down Expand Up @@ -434,8 +434,12 @@ public int hashCode() {

@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;
}
Site site = (Site) o;
return isSiteVerified == site.isSiteVerified &&
Objects.equal(id, site.id) &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,12 @@ public void setSync(boolean sync) {

@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;
}
User user = (User) o;
return sync == user.sync &&
Objects.equal(mySitesModel, user.mySitesModel) &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class MigrateFieldSightViewModel extends ViewModel {
private void copyProjects() {
SQLiteDatabase db = getProjSiteDB();
Cursor cursor = null;
cursor = selectAll(db, MigrationHelper.Table.project);
cursor = selectAll(db, MigrationHelper.Table.PROJECT);
ArrayList<Project> projects = new ArrayList<>();

while (cursor.moveToNext()) {
Expand Down Expand Up @@ -241,8 +241,9 @@ private SQLiteDatabase getProjSiteDB() {
File.separator + MigrationHelper.Folder.DB_FOLDER +
File.separator + MigrationHelper.Database.PROJ_SITES);

if (!dbfile.exists())
if (!dbfile.exists()) {
throw new RuntimeException("Database file does not exist for " + usernameOrEmail);
}

return SQLiteDatabase.openOrCreateDatabase(dbfile, null);
}
Expand All @@ -251,8 +252,9 @@ private SQLiteDatabase getInstancesDB() {
String dbPath = migrationHelper.getOldRootPath() + File.separator + MigrationHelper.Folder.METADATA + File.separator + MigrationHelper.Database.INSTANCES;
File dbfile = new File(dbPath);

if (!dbfile.exists())
if (!dbfile.exists()) {
throw new RuntimeException("Instance Database does not exist for " + usernameOrEmail);
}

return SQLiteDatabase.openOrCreateDatabase(dbfile, null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ String fixSitePhotosPath(String oldPath) {


public static class Table {
public static final String project = "table_project";
public static final String PROJECT = "table_project";
static final String my_site = "table_my_site_detail";
public static final String notifications = "table_notify";
public static final String all_contacts = "table_contact";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ public class APIEndpoint {
public static final String GET_GENERAL_EM = "/forms/api/general/0/{site_id}";
public static final String GET_SCHEDULE_EM = "/forms/api/schedules/0/{site_id}";

public static final String GET_LOCATION_URL = "/fieldsight/api/project-sites/";
public static final String GET_LOCATION_URL = "/fieldsight/api/PROJECT-sites/";
public static final String GET_FORM_SCHEDULE = "/forms/api/schedules/{is_project}/{id}";
public static final String GET_GENERAL_FORM = "/forms/api/general/{is_project}/{id}";
public static final String GET_PROJECT_SITES = "/users/metwo/";


public static final String GET_FS_FORM_DETAIL = "/forms/api/form-detail/{fs_form_id}";
public static final String ASSIGNED_FORM_LIST_PROJECT = "/forms/assignedFormList/project/";
public static final String ASSIGNED_FORM_LIST_PROJECT = "/forms/assignedFormList/PROJECT/";
public static final String ASSIGNED_FORM_LIST_SITE = "/forms/assignedFormList/siteLevel/";

public static final String ADD_FCM = "/fieldsight/fcm/add/";
Expand All @@ -40,7 +40,7 @@ public class APIEndpoint {
public static final String SITE_UPDATE_URL = "/fieldsight/api/update-site/";
public static final String PROJECT_UPDATE_URL = "/fieldsight/api/async_save_project/";

public static final String GET_CLUSTER_LIST = "/fieldsight/project/region-list/{project_id}/";
public static final String GET_CLUSTER_LIST = "/fieldsight/PROJECT/region-list/{project_id}/";
public static final String GET_ALL_SUBMISSION = "/forms/last-submissions/";
public static final String GET_MY_SITES = "/users/mysites";
public static final String GET_MY_SITES_v2 = "users/api/v2/mysites/";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Observable<Site> uploadSite(@Url String url,
@Part("phone") RequestBody phone,
@Part("address") RequestBody address,
@Part("public_desc") RequestBody public_desc,
@Part("project") RequestBody project,
@Part("PROJECT") RequestBody project,
@Part("type") RequestBody type,
@Part("region") RequestBody regionID,
@Part("site_meta_attributes_ans") RequestBody metaAttrs);
Expand Down Expand Up @@ -227,7 +227,7 @@ Observable<Site> updateSite(@Url String url,
@Part("phone") RequestBody phone,
@Part("address") RequestBody address,
@Part("public_desc") RequestBody public_desc,
@Part("project") RequestBody project,
@Part("PROJECT") RequestBody project,
@Part("type") RequestBody type,
@Part("region") RequestBody regionID,
@Part("site_meta_attributes_ans") RequestBody metaAttrs);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ private static NetworkInfo getNetworkStat() {
ConnectivityManager cm = (ConnectivityManager) ctx.getSystemService(Context.CONNECTIVITY_SERVICE);
if (cm != null)
return cm.getActiveNetworkInfo();
else return null;
else {
return null;
}
}

public static boolean isMopbileType() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class Finstance {
@SerializedName("site")
@Expose
private Integer site;
@SerializedName("project")
@SerializedName("PROJECT")
@Expose
private Integer project;
@SerializedName("submitted_by")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,14 @@ private void pullNotificationByDate(String type) {
if (lastUpdatedDate != null) {
String date = lastUpdatedDate.getReceivedDateTime();

String epochTime = DateTimeUtils.tsToSec8601(date)+"";
String epochTime = DateTimeUtils.tsToSec8601(date) + "";
Timber.i("NotificationListActivity, date = %s, epochTime = %s", date, epochTime);
if (epochTime != null) {
getDataFromServer(epochTime, type);
} else {
if (swipeLayout.isRefreshing())
if (swipeLayout.isRefreshing()) {
swipeLayout.setRefreshing(false);
}
Toast.makeText(getApplicationContext(), "Invalid date format", Toast.LENGTH_SHORT).show();
}
} else {
Expand All @@ -208,7 +209,6 @@ private void pullNotificationByDate(String type) {
}



void getDataFromServer(String mEpcoh, String mType) {
NotificationRemoteSource.getInstance().getNotifications(mEpcoh, mType)
.toObservable()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,11 @@ public void updateList(List<FieldSightNotification> newList) {
}

public FieldSightNotification getMostRecentNotification() {
if (fieldSightNotifications.size() > 0) return fieldSightNotifications.get(0);
else return null;
if (fieldSightNotifications.size() > 0) {
return fieldSightNotifications.get(0);
} else {
NotificationsAdapter
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,12 @@ public void setDetail(String detail) {

@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;
}
SyncableItem that = (SyncableItem) o;
return uid == that.uid &&
downloadingStatus == that.downloadingStatus &&
Expand Down
Loading

0 comments on commit 34d19f9

Please sign in to comment.