From 3fae3be6acb549aed48227fe891bda341db21526 Mon Sep 17 00:00:00 2001 From: Nishon Tandukar Date: Tue, 15 Oct 2019 14:05:40 +0545 Subject: [PATCH] Variable init in constucter made final (#403) --- .../fieldsight/naxa/common/DialogFactory.java | 2 - .../naxa/common/FilterDialogAdapter.java | 2 - .../naxa/common/FilterDialogAdapterv2.java | 156 ------------------ .../fieldsight/naxa/common/FilterOption.java | 6 +- .../naxa/common/GridItemDecoration.java | 4 +- .../naxa/common/PairSpinnerAdapter.java | 4 +- .../naxa/common/RecyclerViewEmptySupport.java | 6 +- .../common/RxDownloader/RxDownloader.java | 4 +- .../naxa/common/SiteOverideLocalSource.java | 4 +- .../naxa/common/TouchImageView.java | 11 +- .../naxa/common/ViewModelFactory.java | 4 +- .../naxa/common/anim/FlipAnimator.java | 1 - .../naxa/common/database/SiteOveride.java | 7 - .../naxa/common/event/DataSyncEvent.java | 5 +- .../FormDownloadFailedException.java | 15 -- .../naxa/common/rx/RetrofitException.java | 5 - .../common/view/BaseRecyclerViewAdapter.java | 6 +- .../naxa/contact/ContactAdapter.java | 12 +- .../naxa/contact/ContactRemoteSource.java | 7 - .../naxa/contact/ContactRepository.java | 4 +- .../naxa/educational/DynamicFragment.java | 4 - .../EducationalMaterialActivity.java | 2 - ...ducationalMaterialRecyclerViewAdapter.java | 6 +- .../EducationalMaterialsRemoteSource.java | 4 +- .../naxa/educational/PagerAdapter.java | 2 +- .../FieldSightFirebaseMessagingService.java | 22 +-- .../naxa/flagform/FlagFormRemoteSource.java | 3 +- .../flagform/FlaggedInstanceActivity.java | 13 +- .../forms/FieldSightFormDownloadList.java | 2 +- .../naxa/forms/FormsFragmentHostActivity.java | 4 - .../data/local/FieldSightFormDetails.java | 3 - .../local/FieldSightFormsLocalSource.java | 3 +- .../local/FieldSightFormsLocalSourcev3.java | 2 +- .../data/local/FormDetailsConverter.java | 7 +- .../remote/FieldSightFormRemoteSourceV2.java | 154 ----------------- .../remote/FieldSightFormRemoteSourceV3.java | 2 +- .../ui/EducationalMaterialListActivity.java | 3 +- .../naxa/forms/ui/FieldSightFormVH.java | 5 +- .../naxa/fragments/FSDataManagerList.java | 1 - .../generalforms/GeneralFormsAdapter.java | 14 +- .../GeneralFormsDiffCallback.java | 4 +- .../naxa/generalforms/data/FormType.java | 6 +- .../data/GeneralFormLocalSource.java | 3 +- .../data/GeneralFormRemoteSource.java | 7 +- .../naxa/generalforms/data/GetResponce.java | 1 - .../naxa/login/BaseLoginActivity.java | 11 +- .../fieldsight/naxa/login/LoginActivity.java | 4 +- .../fieldsight/naxa/login/LoginModelImpl.java | 6 +- .../naxa/login/LoginPresenterImpl.java | 4 +- .../naxa/login/model/SiteBuilder.java | 4 + .../migrate/MigrateFieldSightActivity.java | 2 - .../migrate/MigrateFieldSightViewModel.java | 4 +- .../NotificationImageAdapter.java | 2 +- .../NotificationListActivity.java | 2 +- .../NotificationListViewModel.java | 2 +- .../naxa/onboarding/CheckedItem.java | 1 - .../naxa/onboarding/DownloadListAdapter.java | 2 +- .../onboarding/DownloadPresenterImpl.java | 10 +- .../naxa/onboarding/DownloadProgress.java | 6 +- .../DownloadableItemsDiffCallback.java | 5 +- .../fieldsight/naxa/onboarding/XMLForm.java | 8 +- .../onboarding/XMLFormDownloadService.java | 1 - .../LastSubmissionLocalSource.java | 2 +- .../naxa/profile/UserProfileViewModel.java | 10 +- .../naxa/project/ProjectsDiffCallback.java | 4 +- .../project/adapter/MyProjectsAdapter.java | 19 +-- .../naxa/project/data/ProjectLocalSource.java | 2 +- .../naxa/project/data/ProjectRepository.java | 1 - .../data/ProjectSitesRemoteSource.java | 7 +- .../naxa/project/data/ProjectViewModel.java | 2 +- .../scheduled/ScheduleFormsDiffCallback.java | 4 +- .../naxa/scheduled/ScheduledFormsAdapter.java | 14 +- .../data/ScheduledFormRepository.java | 1 - .../data/ScheduledFormsLocalSource.java | 2 +- .../data/ScheduledFormsRemoteSource.java | 4 +- .../fieldsight/naxa/site/SearchAdapter.java | 7 +- .../naxa/site/SiteClusterSpinnerAdapter.java | 4 +- .../naxa/site/SiteDashboardFragment.java | 2 +- .../fieldsight/naxa/site/SiteInfoWindow.java | 1 - .../fieldsight/naxa/site/SiteListAdapter.java | 14 +- .../naxa/site/SiteListFragment.java | 13 +- .../naxa/site/SiteTypeLocalSource.java | 2 +- .../naxa/site/SiteTypeSpinnerAdapter.java | 4 +- .../naxa/site/db/SiteLocalSource.java | 2 +- .../naxa/site/db/SiteRemoteSource.java | 1 - .../naxa/site/db/SiteRepository.java | 4 +- .../site/db/SiteUploadHistoryLocalSource.java | 2 +- .../naxa/site/db/SiteViewModel.java | 41 ----- .../naxa/stages/StageListAdapter.java | 4 +- .../naxa/stages/StageListFragment.java | 4 - .../naxa/stages/StagesDiffCallback.java | 4 +- .../fieldsight/naxa/stages/data/Stage.java | 13 +- .../naxa/stages/data/StageLocalSource.java | 2 +- .../naxa/stages/data/StageRemoteSource.java | 2 +- .../naxa/submissions/MultiViewAdapter.java | 19 +-- .../naxa/submissions/PaginationAdapter.java | 16 +- .../PreviousSubmissionListActivity.java | 13 +- .../TitleDescModelDiffCallback.java | 4 +- .../naxa/submissions/ViewModel.java | 8 +- .../naxa/substages/SubStageDiffCallback.java | 4 +- .../naxa/substages/SubStageListAdapter.java | 16 +- .../naxa/substages/SubStageListFragment.java | 13 +- .../naxa/substages/data/SubStageDAO.java | 1 - .../substages/data/SubStageLocalSource.java | 2 +- .../substages/data/SubStageRepository.java | 3 +- .../naxa/survey/SurveyFormLocalSource.java | 2 +- .../naxa/survey/SurveyFormViewModel.java | 2 +- .../naxa/survey/TitleDescAdapter.java | 6 +- .../naxa/sync/DownloadViewModel.java | 1 - .../sync/DownloadableItemLocalSource.java | 2 +- .../DownloadableItemsDiffCallbackNew.java | 4 +- .../fieldsight/naxa/sync/SyncRepository.java | 4 +- .../naxa/v3/adapter/ProjectListAdapter.java | 4 +- .../v3/forms/FieldSightFormDownloader.java | 6 +- .../naxa/v3/network/ProjectBuilder.java | 4 +- .../naxa/v3/network/SyncLocalSource3.java | 2 +- .../naxa/v3/network/SyncServiceV3.java | 4 +- .../fieldsight/naxa/v3/network/Syncable.java | 4 +- .../android/activities/FileManagerTabs.java | 6 +- .../activities/InstanceChooserList.java | 6 +- .../InstanceUploaderListActivity.java | 1 - .../application/ForceUpdateChecker.java | 5 +- .../odk/collect/android/dao/InstancesDao.java | 11 -- .../android/fragments/DataManagerList.java | 8 +- .../ServerPreferencesFragment.java | 4 +- .../android/provider/FormsProvider.java | 1 - .../android/tasks/DownloadFormsTask.java | 2 +- .../InstanceGoogleSheetsUploaderTask.java | 2 - .../android/utilities/DateTimeUtils.java | 2 - .../utilities/DownloadFormListUtils.java | 1 - .../android/utilities/FormDownloader.java | 2 +- 131 files changed, 249 insertions(+), 760 deletions(-) delete mode 100644 collect_app/src/main/java/org/fieldsight/naxa/common/FilterDialogAdapterv2.java delete mode 100644 collect_app/src/main/java/org/fieldsight/naxa/common/exception/FormDownloadFailedException.java delete mode 100644 collect_app/src/main/java/org/fieldsight/naxa/forms/data/remote/FieldSightFormRemoteSourceV2.java delete mode 100644 collect_app/src/main/java/org/fieldsight/naxa/site/db/SiteViewModel.java diff --git a/collect_app/src/main/java/org/fieldsight/naxa/common/DialogFactory.java b/collect_app/src/main/java/org/fieldsight/naxa/common/DialogFactory.java index 5fcc5283f..38b5650da 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/common/DialogFactory.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/common/DialogFactory.java @@ -23,8 +23,6 @@ import androidx.annotation.NonNull; import androidx.annotation.StringRes; -import com.google.android.material.textfield.TextInputLayout; - import org.fieldsight.collect.android.R; import org.fieldsight.naxa.login.model.Site; import org.odk.collect.android.application.Collect; 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 54b996ba9..5af9561b5 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 @@ -38,7 +38,6 @@ public class FilterDialogAdapter extends RecyclerView.Adapter { private static final int VIEW_TYPE_TEXT = 0, VIEW_TYPE_SPINNER = 1, VIEW_TYPE_BUTTON = 2, VIEW_TYPE_LIST = 3; private final FilterDialogAdapter.RecyclerViewClickListener listener; - private final FilterType selectedSortingOrder; private final RecyclerView recyclerView; private final ThemeUtils themeUtils; private final ArrayList sortList; @@ -48,7 +47,6 @@ public FilterDialogAdapter(Context context, RecyclerView recyclerView, ArrayList themeUtils = new ThemeUtils(context); this.recyclerView = recyclerView; this.sortList = sortList; - this.selectedSortingOrder = selectedSortingOrder; listener = recyclerViewClickListener; } diff --git a/collect_app/src/main/java/org/fieldsight/naxa/common/FilterDialogAdapterv2.java b/collect_app/src/main/java/org/fieldsight/naxa/common/FilterDialogAdapterv2.java deleted file mode 100644 index f36cd1367..000000000 --- a/collect_app/src/main/java/org/fieldsight/naxa/common/FilterDialogAdapterv2.java +++ /dev/null @@ -1,156 +0,0 @@ -package org.fieldsight.naxa.common;/* - * Copyright (C) 2017 Nishon - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ - - -import android.content.Context; -import androidx.annotation.NonNull; -import androidx.core.graphics.drawable.DrawableCompat; -import androidx.recyclerview.widget.RecyclerView; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.Button; -import android.widget.ImageView; -import android.widget.Spinner; -import android.widget.TextView; - -import org.fieldsight.collect.android.R; -import org.odk.collect.android.utilities.ThemeUtils; - -import java.util.ArrayList; - - -public class FilterDialogAdapterv2 extends RecyclerView.Adapter { - private static final int VIEW_TYPE_TEXT = 0, VIEW_TYPE_BUTTON = 2; - private final FilterDialogAdapterv2.RecyclerViewClickListener listener; - - private final RecyclerView recyclerView; - private final ThemeUtils themeUtils; - private final ArrayList sortList; - - - public FilterDialogAdapterv2(Context context, RecyclerView recyclerView, ArrayList sortList, RecyclerViewClickListener recyclerViewClickListener) { - themeUtils = new ThemeUtils(context); - this.recyclerView = recyclerView; - this.sortList = sortList; - listener = recyclerViewClickListener; - } - - @NonNull - @Override - public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { - - View itemLayoutView; - switch (viewType) { - case VIEW_TYPE_BUTTON: - itemLayoutView = LayoutInflater.from(parent.getContext()) - .inflate(R.layout.filter_item_button, parent, false); - return new ViewHolderButton(itemLayoutView); - case VIEW_TYPE_TEXT: - default: - itemLayoutView = LayoutInflater.from(parent.getContext()) - .inflate(R.layout.sort_item_layout, parent, false); - return new ViewHolderText(itemLayoutView); - - } - } - - - @Override - public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { - int viewType = holder.getItemViewType(); - Triplet t = sortList.get(holder.getAdapterPosition()); - switch (viewType) { - case VIEW_TYPE_BUTTON: - break; - case VIEW_TYPE_TEXT: - default: - ViewHolderText viewHolder = (ViewHolderText) holder; - viewHolder.txtViewTitle.setText(String.valueOf(t.getSecond())); - viewHolder.imgViewIcon.setImageResource(R.drawable.ic_sort_by_alpha); - viewHolder.imgViewIcon.setImageDrawable(DrawableCompat.wrap(viewHolder.imgViewIcon.getDrawable()).mutate()); - // int color = position == selectedSortingOrder ? themeUtils.getAccentColor() : themeUtils.getPrimaryTextColor(); - // viewHolder.txtViewTitle.setTextColor(color); - // DrawableCompat.setTintList(viewHolder.imgViewIcon.getDrawable(), position == selectedSortingOrder ? ColorStateList.valueOf(color) : null); - break; - } - } - - - @Override - public int getItemCount() { - return sortList.size(); - } - - public ArrayList getAll() { - return sortList; - } - - @Override - public int getItemViewType(int position) { - - - return VIEW_TYPE_TEXT; - } - - - public class ViewHolderText extends RecyclerView.ViewHolder { - - TextView txtViewTitle; - ImageView imgViewIcon; - - ViewHolderText(final View itemLayoutView) { - super(itemLayoutView); - txtViewTitle = itemLayoutView.findViewById(R.id.title); - imgViewIcon = itemLayoutView.findViewById(R.id.icon); - - itemLayoutView.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - listener.onItemClicked(ViewHolderText.this, getLayoutPosition(), sortList.get(getLayoutPosition())); - } - }); - } - - public void updateItemColor(int selectedSortingOrder) { - ViewHolderText previousHolder = (ViewHolderText) recyclerView.findViewHolderForAdapterPosition(selectedSortingOrder); - previousHolder.txtViewTitle.setTextColor(themeUtils.getPrimaryTextColor()); - DrawableCompat.setTintList(previousHolder.imgViewIcon.getDrawable(), null); - - txtViewTitle.setTextColor(themeUtils.getAccentColor()); - DrawableCompat.setTint(imgViewIcon.getDrawable(), themeUtils.getAccentColor()); - } - } - - public class ViewHolderButton extends RecyclerView.ViewHolder implements View.OnClickListener { - - Button button; - - - ViewHolderButton(final View itemLayoutView) { - super(itemLayoutView); - button = itemLayoutView.findViewById(R.id.filter_apply); - button.setOnClickListener(this); - } - - - @Override - public void onClick(View v) { - } - } - - public interface RecyclerViewClickListener { - void onItemClicked(ViewHolderText holder, int position, Triplet filterOption); - } -} diff --git a/collect_app/src/main/java/org/fieldsight/naxa/common/FilterOption.java b/collect_app/src/main/java/org/fieldsight/naxa/common/FilterOption.java index 6e827d347..8c57273ae 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/common/FilterOption.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/common/FilterOption.java @@ -14,9 +14,9 @@ public enum FilterType { CONFIRM_BUTTON, } - private FilterType type; - private String label; - private List options; + private final FilterType type; + private final String label; + private final List options; private Pair selection; public FilterOption(FilterType type, String label,List site) { diff --git a/collect_app/src/main/java/org/fieldsight/naxa/common/GridItemDecoration.java b/collect_app/src/main/java/org/fieldsight/naxa/common/GridItemDecoration.java index 38e7561d4..7902fd0e5 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/common/GridItemDecoration.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/common/GridItemDecoration.java @@ -8,8 +8,8 @@ public class GridItemDecoration extends RecyclerView.ItemDecoration { - private int mSizeGridSpacingPx; - private int mGridSize; + private final int mSizeGridSpacingPx; + private final int mGridSize; private boolean mNeedLeftSpacing = false; diff --git a/collect_app/src/main/java/org/fieldsight/naxa/common/PairSpinnerAdapter.java b/collect_app/src/main/java/org/fieldsight/naxa/common/PairSpinnerAdapter.java index 7a3151891..23b234382 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/common/PairSpinnerAdapter.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/common/PairSpinnerAdapter.java @@ -12,9 +12,9 @@ public class PairSpinnerAdapter extends ArrayAdapter { - private Context context; + private final Context context; - private List values; + private final List values; public PairSpinnerAdapter(Context context, int textViewResourceId, List values) { super(context, textViewResourceId, values); diff --git a/collect_app/src/main/java/org/fieldsight/naxa/common/RecyclerViewEmptySupport.java b/collect_app/src/main/java/org/fieldsight/naxa/common/RecyclerViewEmptySupport.java index 8dd8ba21b..c7f63b1f6 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/common/RecyclerViewEmptySupport.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/common/RecyclerViewEmptySupport.java @@ -21,10 +21,8 @@ public class RecyclerViewEmptySupport extends RecyclerView { private View emptyView; private View progressView; - private long lastDispatch; - - private AdapterDataObserver emptyObserver = new AdapterDataObserver() { + private final AdapterDataObserver emptyObserver = new AdapterDataObserver() { @Override public void onItemRangeChanged(int positionStart, int itemCount) { @@ -119,7 +117,7 @@ public void setEmptyView(View emptyView, @Nullable String message, OnEmptyLayout .setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { - Intent intent = new Intent(Collect.getInstance(), ContentDownloadActivity.class); + Intent intent = new Intent(Collect.getInstance(), ContentDownloadActivity.class); intent.addFlags(FLAG_ACTIVITY_NEW_TASK); Collect.getInstance().startActivity(intent); } diff --git a/collect_app/src/main/java/org/fieldsight/naxa/common/RxDownloader/RxDownloader.java b/collect_app/src/main/java/org/fieldsight/naxa/common/RxDownloader/RxDownloader.java index 37be0098d..781d2c538 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/common/RxDownloader/RxDownloader.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/common/RxDownloader/RxDownloader.java @@ -28,8 +28,8 @@ public class RxDownloader { private static final String DEFAULT_MIME_TYPE = "*/*"; - private Context context; - private LongSparseArray> subjectMap = new LongSparseArray<>(); + private final Context context; + private final LongSparseArray> subjectMap = new LongSparseArray<>(); private DownloadManager downloadManager; public RxDownloader(@NonNull Context context) { diff --git a/collect_app/src/main/java/org/fieldsight/naxa/common/SiteOverideLocalSource.java b/collect_app/src/main/java/org/fieldsight/naxa/common/SiteOverideLocalSource.java index f74b3b26d..39d129634 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/common/SiteOverideLocalSource.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/common/SiteOverideLocalSource.java @@ -15,8 +15,8 @@ public class SiteOverideLocalSource implements BaseLocalDataSource { private static SiteOverideLocalSource INSTANCE = null; - private SiteOverideDAO dao; - private SiteDao siteDao; + private final SiteOverideDAO dao; + private final SiteDao siteDao; private SiteOverideLocalSource() { FieldSightConfigDatabase database = FieldSightConfigDatabase.getDatabase(Collect.getInstance());//todo inject context diff --git a/collect_app/src/main/java/org/fieldsight/naxa/common/TouchImageView.java b/collect_app/src/main/java/org/fieldsight/naxa/common/TouchImageView.java index 12565a6ef..27632f930 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/common/TouchImageView.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/common/TouchImageView.java @@ -16,7 +16,6 @@ import android.os.Bundle; import android.os.Parcelable; import android.util.AttributeSet; -import android.util.Log; import android.view.GestureDetector; import android.view.MotionEvent; import android.view.ScaleGestureDetector; @@ -29,7 +28,7 @@ public class TouchImageView extends AppCompatImageView { - private static final String DEBUG = "DEBUG"; + // // SuperMin and SuperMax multipliers. Determine how much the image can be @@ -1022,7 +1021,7 @@ private class PrivateOnTouchListener implements OnTouchListener { // // Remember last point position for dragging // - private PointF last = new PointF(); + private final PointF last = new PointF(); @Override public boolean onTouch(View v, MotionEvent event) { @@ -1171,9 +1170,9 @@ private class DoubleTapZoom implements Runnable { private final float startZoom, targetZoom; private final float bitmapX, bitmapY; private final boolean stretchImageToSuper; - private AccelerateDecelerateInterpolator interpolator = new AccelerateDecelerateInterpolator(); - private PointF startTouch; - private PointF endTouch; + private final AccelerateDecelerateInterpolator interpolator = new AccelerateDecelerateInterpolator(); + private final PointF startTouch; + private final PointF endTouch; DoubleTapZoom(float targetZoom, float focusX, float focusY, boolean stretchImageToSuper) { setState(State.ANIMATE_ZOOM); diff --git a/collect_app/src/main/java/org/fieldsight/naxa/common/ViewModelFactory.java b/collect_app/src/main/java/org/fieldsight/naxa/common/ViewModelFactory.java index 60d59f30f..2b4de40ba 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/common/ViewModelFactory.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/common/ViewModelFactory.java @@ -61,8 +61,6 @@ public class ViewModelFactory extends ViewModelProvider.NewInstanceFactory { private final ContactRepository contactRepository; - private final Application application; - public ViewModelFactory(Application application, GeneralFormRepository repository, ScheduledFormRepository scheduledFormRepository, @@ -74,7 +72,7 @@ public ViewModelFactory(Application application, FieldSightNotificationRepository notificationRepository, ContactRepository contactRepository ) { - this.application = application; + this.generalFormRepository = repository; this.scheduledFormRepository = scheduledFormRepository; this.stageFormRepository = stageFormRepository; diff --git a/collect_app/src/main/java/org/fieldsight/naxa/common/anim/FlipAnimator.java b/collect_app/src/main/java/org/fieldsight/naxa/common/anim/FlipAnimator.java index 584db0f87..68d80cee0 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/common/anim/FlipAnimator.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/common/anim/FlipAnimator.java @@ -9,7 +9,6 @@ public class FlipAnimator { - private static String TAG = FlipAnimator.class.getSimpleName(); private static AnimatorSet leftIn, rightOut, leftOut, rightIn; /** diff --git a/collect_app/src/main/java/org/fieldsight/naxa/common/database/SiteOveride.java b/collect_app/src/main/java/org/fieldsight/naxa/common/database/SiteOveride.java index cb364e6e5..6152c5bdb 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/common/database/SiteOveride.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/common/database/SiteOveride.java @@ -22,14 +22,7 @@ public class SiteOveride { private String scheduleFormIds; private String stagedFormIds; - @Ignore - private List generalformIdList; - - @Ignore - private List scheduleFormIdList; - @Ignore - private List stagedformIdList; public SiteOveride() { diff --git a/collect_app/src/main/java/org/fieldsight/naxa/common/event/DataSyncEvent.java b/collect_app/src/main/java/org/fieldsight/naxa/common/event/DataSyncEvent.java index 1b5b76172..eaefc334e 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/common/event/DataSyncEvent.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/common/event/DataSyncEvent.java @@ -10,8 +10,8 @@ public class DataSyncEvent { - private String event; - private int uid; + private final String event; + private final int uid; private DownloadProgress downloadProgress; @@ -21,7 +21,6 @@ public DataSyncEvent(int uid, String event) { } - public DataSyncEvent(int uid, DownloadProgress downloadProgress) { this.event = EVENT_UPDATE; this.uid = uid; diff --git a/collect_app/src/main/java/org/fieldsight/naxa/common/exception/FormDownloadFailedException.java b/collect_app/src/main/java/org/fieldsight/naxa/common/exception/FormDownloadFailedException.java deleted file mode 100644 index c052b235f..000000000 --- a/collect_app/src/main/java/org/fieldsight/naxa/common/exception/FormDownloadFailedException.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.fieldsight.naxa.common.exception; - -public class FormDownloadFailedException extends Exception { - - private String failedUrls; - - public FormDownloadFailedException(String message, String failedUrls) { - super(message); - this.failedUrls = failedUrls; - } - - public String getFailedUrls() { - return failedUrls; - } -} \ No newline at end of file diff --git a/collect_app/src/main/java/org/fieldsight/naxa/common/rx/RetrofitException.java b/collect_app/src/main/java/org/fieldsight/naxa/common/rx/RetrofitException.java index 597d56be3..fdd110545 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/common/rx/RetrofitException.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/common/rx/RetrofitException.java @@ -2,16 +2,11 @@ import android.net.Uri; -import com.google.gson.reflect.TypeToken; - -import org.fieldsight.naxa.common.GSONInstance; import org.json.JSONException; import org.json.JSONObject; import java.io.IOException; import java.lang.annotation.Annotation; -import java.lang.reflect.Type; -import java.util.ArrayList; import java.util.regex.Matcher; import java.util.regex.Pattern; 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 73809e58f..0eac164da 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 @@ -7,16 +7,14 @@ import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; -import org.odk.collect.android.application.Collect; - import java.util.List; import timber.log.Timber; public abstract class BaseRecyclerViewAdapter extends RecyclerView.Adapter { - private List l; - private int layout; + private final List l; + private final int layout; protected BaseRecyclerViewAdapter(List l, int layout) { this.l = l; 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 a5a8cdc79..f0917a5b4 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 @@ -24,8 +24,8 @@ public class ContactAdapter extends RecyclerView.Adapter { - private List contactList; - private ContactDetailListener contactDetailListener; + private final List contactList; + private final ContactDetailListener contactDetailListener; private Context context; @@ -37,10 +37,8 @@ public class ContactAdapter extends RecyclerView.Adapter { private static ContactRemoteSource INSTANCE; diff --git a/collect_app/src/main/java/org/fieldsight/naxa/contact/ContactRepository.java b/collect_app/src/main/java/org/fieldsight/naxa/contact/ContactRepository.java index 4e3b41504..24c49982d 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/contact/ContactRepository.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/contact/ContactRepository.java @@ -11,7 +11,7 @@ public class ContactRepository implements BaseRepository private final ContactLocalSource localSource; - private final ContactRemoteSource remoteSource; + private static ContactRepository INSTANCE = null; @@ -29,7 +29,7 @@ public static ContactRepository getInstance(ContactLocalSource localSource, Cont public ContactRepository(ContactLocalSource localSource, ContactRemoteSource remoteSource) { this.localSource = localSource; - this.remoteSource = remoteSource; + } @Override diff --git a/collect_app/src/main/java/org/fieldsight/naxa/educational/DynamicFragment.java b/collect_app/src/main/java/org/fieldsight/naxa/educational/DynamicFragment.java index 711db569d..165a9f35d 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/educational/DynamicFragment.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/educational/DynamicFragment.java @@ -1,13 +1,9 @@ package org.fieldsight.naxa.educational; -import android.content.Context; import android.os.Bundle; - import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import android.view.animation.AnimationUtils; -import android.view.animation.LayoutAnimationController; import androidx.annotation.NonNull; import androidx.annotation.Nullable; diff --git a/collect_app/src/main/java/org/fieldsight/naxa/educational/EducationalMaterialActivity.java b/collect_app/src/main/java/org/fieldsight/naxa/educational/EducationalMaterialActivity.java index 93a10ed2a..037b208f2 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/educational/EducationalMaterialActivity.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/educational/EducationalMaterialActivity.java @@ -65,8 +65,6 @@ public class EducationalMaterialActivity extends CollectAbstractActivity impleme public TextView subStageTitle; List fragments = new Vector<>(); - private ArrayList generalFormList; - private String fsFormId, id, deployedFrom, formType; private static Single> getFsFormIdsFromGeneral(ArrayList list) { 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 e50d65132..dfaad671a 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 @@ -33,12 +33,12 @@ public class EducationalMaterialRecyclerViewAdapter extends RecyclerView.Adapter { - private String TAG = "Education Material"; + private final String TAG = "Education Material"; // The items to display in your RecyclerView - private List items; + private final List items; private static final int TEXT_VIEW = 0, IMAGE = 1, VIDEO = 2, PDF = 3; - private Context context; + private final Context context; // Provide a suitable constructor (depends on the kind of dataset) public EducationalMaterialRecyclerViewAdapter(Context context, List items) { 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 0103500e7..bc5809400 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 @@ -47,7 +47,7 @@ public class EducationalMaterialsRemoteSource implements BaseRemoteDataSource { private static EducationalMaterialsRemoteSource INSTANCE; - private final EducationalMaterialsDao dao; + public static EducationalMaterialsRemoteSource getInstance() { if (INSTANCE == null) { @@ -58,7 +58,7 @@ public static EducationalMaterialsRemoteSource getInstance() { private EducationalMaterialsRemoteSource() { FieldSightDatabase database = FieldSightDatabase.getDatabase(Collect.getInstance());//todo inject context - this.dao = database.getEducationalMaterialDAO(); + } diff --git a/collect_app/src/main/java/org/fieldsight/naxa/educational/PagerAdapter.java b/collect_app/src/main/java/org/fieldsight/naxa/educational/PagerAdapter.java index 11803796f..99eb275b0 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/educational/PagerAdapter.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/educational/PagerAdapter.java @@ -14,7 +14,7 @@ public class PagerAdapter extends FragmentPagerAdapter { - private List fragments; + private final List fragments; /** * @param fm * @param fragments 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 240c5a3d8..126961498 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 @@ -35,9 +35,9 @@ public class FieldSightFirebaseMessagingService extends FirebaseMessagingService { - private static final String TAG = "FirebaseService"; + private final static AtomicInteger notificationId = new AtomicInteger(0); - private static final String NOTIFY_STATUS = "status"; + public static final String NEW_FORM = "New Form"; @@ -56,7 +56,7 @@ public class FieldSightFirebaseMessagingService extends FirebaseMessagingService String date_str; String localTime; - public static Boolean notificationStatus = false; + DateFormat dateFormat, date1; Date date, currentLocalTime; @@ -64,21 +64,20 @@ public class FieldSightFirebaseMessagingService extends FirebaseMessagingService Uri notificationSound; Ringtone ringtonePlayer; - private String comment; + private String fsFormId; private String fsFormIdProject; private String fsFormSubmissionId; private String formType; private String formName; private String formComment; - private String form; + private String formVerion; - private String deleteForm; + private String isDeployed, webDeployedId; private String notificationDetailsUrl = ""; - private String isDeployedFromProject;//todo: this needs to be checked and removed coz we are using isDeployedFromSite in flag forms private boolean isDeployedFromSite; private String siteIdentifier; @@ -230,9 +229,7 @@ private void parseNotificationData(Map notificationData) { if (notificationData.containsKey("form")) { String form = notificationData.get("form"); } - if (notificationData.containsKey("is_delete")) { - deleteForm = notificationData.get("is_delete"); - } + if (notificationData.containsKey("is_deployed")) { isDeployed = notificationData.get("is_deployed"); } @@ -244,11 +241,6 @@ private void parseNotificationData(Map notificationData) { webDeployedId = notificationData.get("deploy_id"); Timber.i("deploy_id %s", webDeployedId); } - - if (notificationData.containsKey("is_project")) { - isDeployedFromProject = notificationData.get("is_project"); - } - if (notificationData.containsKey("project_form_id")) { fsFormIdProject = notificationData.get("project_form_id"); } 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 4bb2e938c..cb9a3dace 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 @@ -36,8 +36,7 @@ public class FlagFormRemoteSource { private static FlagFormRemoteSource INSTANCE; - String INSTANCES_PATH = Collect.INSTANCES_PATH.replace(Environment.getExternalStorageDirectory().toString(), ""); - private FSInstancesDao instancesDao; + private final FSInstancesDao instancesDao; public static FlagFormRemoteSource getINSTANCE() { 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 112c43d31..d6f0e7aec 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 @@ -74,12 +74,9 @@ public class FlaggedInstanceActivity extends BaseActivity implements View.OnClickListener, NotificationImageAdapter.OnItemClickListener { - private static String TAG = "Comment Activity"; + private static final String TAG = "Comment Activity"; //constants for form status - private final String FLAGGED_FORM = "FLAGGED"; - private final String OUTSTANDING_FORM = "Outstanding"; - private final String REJECTED_FORM = "REJECTED"; - private final String APPROVED_FORM = "APPROVED"; + Context context = this; @@ -91,11 +88,9 @@ public class FlaggedInstanceActivity extends BaseActivity implements View.OnClic private FieldSightNotification loadedFieldSightNotification; private Toolbar toolbar; - - private DownloadFormListTask downloadFormListTask; private DownloadFormsTask downloadFormsTask; private ProgressDialog dialog; - private HashMap formResult; + private Dialog errorDialog; private FormsDao formsDao; private FSInstancesDao instancesDao; @@ -135,7 +130,7 @@ protected void onCreate(Bundle savedInstanceState) { loadedFieldSightNotification = getIntent().getParcelableExtra(Constant.EXTRA_OBJECT); - formResult = new HashMap<>(); + setupData(loadedFieldSightNotification); setupSiteCard(loadedFieldSightNotification); diff --git a/collect_app/src/main/java/org/fieldsight/naxa/forms/FieldSightFormDownloadList.java b/collect_app/src/main/java/org/fieldsight/naxa/forms/FieldSightFormDownloadList.java index 1cff84916..568dbd226 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/forms/FieldSightFormDownloadList.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/forms/FieldSightFormDownloadList.java @@ -127,7 +127,7 @@ public class FieldSightFormDownloadList extends FormListActivity implements Form public static final String FORM_ID_KEY = "formid"; public static final String FORM_VERSION_KEY = "formversion"; - private final int totalTimesAsyncTaskHasToRun = 2; + private String alertMsg; private boolean alertShowing; diff --git a/collect_app/src/main/java/org/fieldsight/naxa/forms/FormsFragmentHostActivity.java b/collect_app/src/main/java/org/fieldsight/naxa/forms/FormsFragmentHostActivity.java index 467ca7f37..81108f4a7 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/forms/FormsFragmentHostActivity.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/forms/FormsFragmentHostActivity.java @@ -8,15 +8,11 @@ import androidx.annotation.Nullable; import androidx.appcompat.widget.Toolbar; -import androidx.fragment.app.FragmentActivity; import androidx.lifecycle.Observer; -import androidx.lifecycle.ViewModelProviders; import org.fieldsight.collect.android.R; import org.fieldsight.naxa.common.FieldSightUserSession; import org.fieldsight.naxa.common.InternetUtils; -import org.fieldsight.naxa.common.ViewModelFactory; -import org.fieldsight.naxa.forms.viewmodel.FieldSightFormViewModel; import org.fieldsight.naxa.login.model.Project; import org.fieldsight.naxa.login.model.Site; import org.fieldsight.naxa.notificationslist.NotificationListActivity; 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 bb2e9bc3b..6b57ba42a 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 @@ -5,12 +5,9 @@ import androidx.room.Ignore; import androidx.room.PrimaryKey; - import com.google.gson.annotations.SerializedName; -import org.fieldsight.naxa.forms.data.local.FormSchedule; import org.fieldsight.naxa.stages.data.SubStage; -import org.json.JSONObject; import org.odk.collect.android.logic.FormDetails; import java.util.ArrayList; diff --git a/collect_app/src/main/java/org/fieldsight/naxa/forms/data/local/FieldSightFormsLocalSource.java b/collect_app/src/main/java/org/fieldsight/naxa/forms/data/local/FieldSightFormsLocalSource.java index 66f9796e7..d6947ee62 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/forms/data/local/FieldSightFormsLocalSource.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/forms/data/local/FieldSightFormsLocalSource.java @@ -3,7 +3,6 @@ import androidx.lifecycle.LiveData; import org.fieldsight.naxa.common.BaseLocalDataSourceRX; -import org.fieldsight.naxa.common.Constant; import org.fieldsight.naxa.common.FieldSightDatabase; import org.odk.collect.android.application.Collect; @@ -15,7 +14,7 @@ public class FieldSightFormsLocalSource implements BaseLocalDataSourceRX { private static FieldSightFormsLocalSource INSTANCE; - private FieldSightFormDetailDAO dao; + private final FieldSightFormDetailDAO dao; private FieldSightFormsLocalSource() { FieldSightDatabase database = FieldSightDatabase.getDatabase(Collect.getInstance());//todo inject context diff --git a/collect_app/src/main/java/org/fieldsight/naxa/forms/data/local/FieldSightFormsLocalSourcev3.java b/collect_app/src/main/java/org/fieldsight/naxa/forms/data/local/FieldSightFormsLocalSourcev3.java index 070b01bf9..cfa12dd6e 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/forms/data/local/FieldSightFormsLocalSourcev3.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/forms/data/local/FieldSightFormsLocalSourcev3.java @@ -32,7 +32,7 @@ public class FieldSightFormsLocalSourcev3 implements BaseLocalDataSourceRX { private static FieldSightFormsLocalSourcev3 INSTANCE; - private FieldSightFormDetailDAOV3 dao; + private final FieldSightFormDetailDAOV3 dao; private FieldSightFormsLocalSourcev3() { FieldSightDatabase database = FieldSightDatabase.getDatabase(Collect.getInstance());//todo inject context diff --git a/collect_app/src/main/java/org/fieldsight/naxa/forms/data/local/FormDetailsConverter.java b/collect_app/src/main/java/org/fieldsight/naxa/forms/data/local/FormDetailsConverter.java index ecd1b69c0..1df94974a 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/forms/data/local/FormDetailsConverter.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/forms/data/local/FormDetailsConverter.java @@ -7,6 +7,8 @@ import java.io.Serializable; +import timber.log.Timber; + public class FormDetailsConverter implements Serializable { @TypeConverter @@ -19,7 +21,8 @@ public String fromFormDetail(FormDetails formDetails) { " \"formID\": \""+formDetails.getFormID()+"\",\n" + " \"version\": \""+formDetails.getFormVersion()+"\",\n" + " \"hash\": \""+formDetails.getHash()+"\""; - }catch (Exception e){e.printStackTrace();} + }catch (Exception e){ + Timber.e(e);;} return jsonData += "}"; } @@ -29,7 +32,7 @@ public FormDetails fromString(String value) { JSONObject jsonObject = new JSONObject(value); return FieldsightFormDetailsv3.formDetailsfromJSON(jsonObject); } catch (Exception e) { - e.printStackTrace(); + Timber.e(e);; return null; } diff --git a/collect_app/src/main/java/org/fieldsight/naxa/forms/data/remote/FieldSightFormRemoteSourceV2.java b/collect_app/src/main/java/org/fieldsight/naxa/forms/data/remote/FieldSightFormRemoteSourceV2.java deleted file mode 100644 index fe211c18d..000000000 --- a/collect_app/src/main/java/org/fieldsight/naxa/forms/data/remote/FieldSightFormRemoteSourceV2.java +++ /dev/null @@ -1,154 +0,0 @@ -package org.fieldsight.naxa.forms.data.remote; - -import android.text.TextUtils; -import android.util.Pair; -import android.util.SparseIntArray; - -import org.fieldsight.naxa.common.GSONInstance; -import org.fieldsight.naxa.forms.data.local.FieldSightFormsLocalSource; -import org.fieldsight.naxa.login.model.Project; -import org.fieldsight.naxa.network.APIEndpoint; -import org.fieldsight.naxa.network.ServiceGenerator; -import org.fieldsight.naxa.forms.data.local.FieldSightFormDetails; -import org.fieldsight.naxa.v3.forms.FieldSightFormDownloader; -import org.fieldsight.naxa.v3.network.ApiV3Interface; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.odk.collect.android.dao.FormsDao; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.concurrent.Callable; - -import io.reactivex.Observable; -import io.reactivex.ObservableSource; -import io.reactivex.functions.Consumer; -import io.reactivex.functions.Function; -import okhttp3.ResponseBody; -import timber.log.Timber; - -public class FieldSightFormRemoteSourceV2 { - - private static FieldSightFormRemoteSourceV2 INSTANCE; - private FormsDao formsDao; - - public static FieldSightFormRemoteSourceV2 getInstance() { - if (INSTANCE == null) { - INSTANCE = new FieldSightFormRemoteSourceV2(); - } - return INSTANCE; - } - - private FieldSightFormRemoteSourceV2() { - this.formsDao = new FormsDao(); - } - - private String buildUrlWithParams(List projects) { - StringBuilder url = new StringBuilder(); - url.append(APIEndpoint.V3.GET_FORMS); - url.append("?"); - for (int i = 0; i < projects.size(); i++) { - url.append(APIEndpoint.PARAMS.PROJECT_ID); - url.append("="); - url.append(projects.get(i).getId()); - if (i < projects.size() - 1) { - url.append("&"); - } - } - return url.toString(); - } - - public Observable> getFormUsingProjectId(List projects) { - return ServiceGenerator.getRxClient().create(ApiV3Interface.class) - .getFormsFromUrlAsRaw(buildUrlWithParams(projects)) - .map(this::mapToFieldSightFormDetails) - .doOnNext(new Consumer>() { - @Override - public void accept(ArrayList fieldSightFormDetails) { - - FieldSightFormsLocalSource.getInstance().save(fieldSightFormDetails); - } - }) - .flatMap((Function, ObservableSource>>) fieldSightFormDetails -> { - FieldSightFormDownloader fieldSightFormDownloader = new FieldSightFormDownloader(false); - - return Observable.just(fieldSightFormDetails) - .flatMapIterable((Function, Iterable>) fieldSightFormDetails1 -> fieldSightFormDetails1) - .concatMap((Function>>) formDetails -> downloadSingleForm(formDetails, fieldSightFormDownloader)) - .doOnNext(new Consumer>() { - @Override - public void accept(Pair fieldSightFormDetailsStringPair) { - if (fieldSightFormDetailsStringPair == null) { - Timber.w("FieldSightFormDetails pair is null"); - return; - } - - String message = fieldSightFormDetailsStringPair.second; - Timber.i(message); - } - }); - }); - } - - private ArrayList mapToFieldSightFormDetails(ResponseBody responseBody) throws IOException, JSONException { - JSONObject response = new JSONObject(responseBody.string()); - Iterator formTypes = response.keys(); - FieldSightFormDetails fieldSightForm; - ArrayList fieldSightForms = new ArrayList<>(); - SparseIntArray projectFormMap = new SparseIntArray(); - - while (formTypes.hasNext()) { - String formKey = formTypes.next(); - JSONArray formList = response.getJSONArray(formKey); - - for (int i = 0; i < formList.length(); i++) { - JSONObject form = formList.getJSONObject(i); - fieldSightForm = GSONInstance.getInstance().fromJson(form.toString(), FieldSightFormDetails.class); - fieldSightForm.setFormName(fieldSightForm.getOdkFormName()); - fieldSightForm.setFormType(formKey); - - if (TextUtils.equals("stage", formKey)) { - //todo: stopping stage download form tests; needs to be removed - Nishon - continue; - } - - fieldSightForm.setProjectId(getProjectId(fieldSightForm)); - fieldSightForms.add(fieldSightForm); - incrementFormCountForProject(projectFormMap, getProjectId(fieldSightForm)); - } - } - - - for (FieldSightFormDetails fd : fieldSightForms) { - fd.setTotalFormsInProject(projectFormMap.get(fd.getProjectId())); - } - - return fieldSightForms; - } - - private Integer getProjectId(FieldSightFormDetails fieldSightForm) { - String value = fieldSightForm.getFormDeployedProjectId() != null ? fieldSightForm.getFormDeployedProjectId() : String.valueOf(fieldSightForm.getProjectId()); - return Integer.parseInt(value); - } - - - private Observable> downloadSingleForm(FieldSightFormDetails formDetails, FieldSightFormDownloader formDownloader) { - return Observable.fromCallable(new Callable>() { - @Override - public Pair call() throws Exception { - return formDownloader.downloadSingleFieldSightForm(formDetails); - } - }); - } - - - - - private void incrementFormCountForProject(SparseIntArray projectTotalFormMap, Integer projectId) { - projectTotalFormMap.put(projectId, projectTotalFormMap.get(projectId, 0) + 1); - } -} 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 e32d26c50..7b3671369 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 @@ -34,7 +34,7 @@ public class FieldSightFormRemoteSourceV3 { private static FieldSightFormRemoteSourceV3 INSTANCE; - private FormsDao formsDao; + private final FormsDao formsDao; FieldSightFormDownloader fieldSightFormDownloader = new FieldSightFormDownloader(false); // holds the projectid and total number of forms SparseIntArray projectIdUrlMap; 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 274c533a5..9d7b6d43d 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 @@ -20,7 +20,6 @@ import org.fieldsight.naxa.educational.Edu_PDF_Model; import org.fieldsight.naxa.educational.Edu_Title_Desc_Model; import org.fieldsight.naxa.educational.PagerAdapter; -import org.fieldsight.naxa.forms.data.local.FieldSightFormsLocalSource; import org.fieldsight.naxa.forms.data.local.FieldSightFormsLocalSourcev3; import org.fieldsight.naxa.forms.data.local.FieldsightFormDetailsv3; import org.fieldsight.naxa.generalforms.data.Em; @@ -53,7 +52,7 @@ public class EducationalMaterialListActivity extends CollectAbstractActivity { List fragments = new Vector<>(); - private int defaultPagerPosition = 0; + private final int defaultPagerPosition = 0; private PagerAdapter mPagerAdapter; public ViewPager viewPager; public TabLayout tabLayout; diff --git a/collect_app/src/main/java/org/fieldsight/naxa/forms/ui/FieldSightFormVH.java b/collect_app/src/main/java/org/fieldsight/naxa/forms/ui/FieldSightFormVH.java index 0419dcc92..fe512036f 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/forms/ui/FieldSightFormVH.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/forms/ui/FieldSightFormVH.java @@ -8,13 +8,12 @@ import androidx.recyclerview.widget.RecyclerView; import org.fieldsight.collect.android.R; -import org.fieldsight.naxa.forms.data.local.FieldSightFormDetails; import org.fieldsight.naxa.forms.data.local.FieldsightFormDetailsv3; import org.odk.collect.android.logic.FormDetails; public class FieldSightFormVH extends RecyclerView.ViewHolder { - private TextView tvTitle, tvSubtitle, tvIconText; - private Button btnViewSubmission, btnViewEduMaterial; + private final TextView tvTitle, tvSubtitle, tvIconText; + private final Button btnViewSubmission, btnViewEduMaterial; protected FieldSightFormVH(@NonNull View itemView) { super(itemView); diff --git a/collect_app/src/main/java/org/fieldsight/naxa/fragments/FSDataManagerList.java b/collect_app/src/main/java/org/fieldsight/naxa/fragments/FSDataManagerList.java index 657d53ae4..3a1fb1595 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/fragments/FSDataManagerList.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/fragments/FSDataManagerList.java @@ -2,7 +2,6 @@ import android.os.Bundle; -import androidx.annotation.Nullable; import androidx.loader.content.CursorLoader; import org.fieldsight.naxa.helpers.FSInstancesDao; diff --git a/collect_app/src/main/java/org/fieldsight/naxa/generalforms/GeneralFormsAdapter.java b/collect_app/src/main/java/org/fieldsight/naxa/generalforms/GeneralFormsAdapter.java index c972ce18b..4c50a27c1 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/generalforms/GeneralFormsAdapter.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/generalforms/GeneralFormsAdapter.java @@ -33,8 +33,8 @@ public class GeneralFormsAdapter extends RecyclerView.Adapter { - private ArrayList generalForms; - private OnFormItemClickListener listener; + private final ArrayList generalForms; + private final OnFormItemClickListener listener; GeneralFormsAdapter(ArrayList totalList, OnFormItemClickListener listener) { this.generalForms = totalList; @@ -164,11 +164,11 @@ public ArrayList getAll() { public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { - private TextView tvFormName, tvDesc, tvIconText, tvSubtext; - private Button btnOpenEdu, btnOpenHistory; - private ImageView ivCardCircle; - private CardView cardView; - private ImageButton btnExpandCard; + private final TextView tvFormName, tvDesc, tvIconText, tvSubtext; + private final Button btnOpenEdu, btnOpenHistory; + private final ImageView ivCardCircle; + private final CardView cardView; + private final ImageButton btnExpandCard; public ViewHolder(View view) { diff --git a/collect_app/src/main/java/org/fieldsight/naxa/generalforms/GeneralFormsDiffCallback.java b/collect_app/src/main/java/org/fieldsight/naxa/generalforms/GeneralFormsDiffCallback.java index a157643ed..d7d7fd0d5 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/generalforms/GeneralFormsDiffCallback.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/generalforms/GeneralFormsDiffCallback.java @@ -10,8 +10,8 @@ public class GeneralFormsDiffCallback extends DiffUtil.Callback { - private List oldGeneralForms; - private List newGeneralForms; + private final List oldGeneralForms; + private final List newGeneralForms; public GeneralFormsDiffCallback(List newGeneralForms, List oldGeneralForms) { this.newGeneralForms = newGeneralForms; diff --git a/collect_app/src/main/java/org/fieldsight/naxa/generalforms/data/FormType.java b/collect_app/src/main/java/org/fieldsight/naxa/generalforms/data/FormType.java index 30fa75449..15aa780b1 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/generalforms/data/FormType.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/generalforms/data/FormType.java @@ -12,13 +12,13 @@ public class FormType { @SerializedName("is_staged") - private boolean isStaged; + private final boolean isStaged; @SerializedName("is_survey") - private boolean isSurvey; + private final boolean isSurvey; @SerializedName("is_scheduled") - private boolean isScheduled; + private final boolean isScheduled; public boolean isStaged() { return isStaged; 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 5fafc70da..52cd49968 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 @@ -29,13 +29,14 @@ import io.reactivex.functions.Function; import io.reactivex.observers.DisposableObserver; import io.reactivex.schedulers.Schedulers; +import timber.log.Timber; import static org.fieldsight.naxa.common.Constant.FormDeploymentFrom.SITE; public class GeneralFormLocalSource implements BaseLocalDataSource { private static GeneralFormLocalSource INSTANCE; - private GeneralFormDAO dao; + private final GeneralFormDAO dao; private GeneralFormLocalSource() { diff --git a/collect_app/src/main/java/org/fieldsight/naxa/generalforms/data/GeneralFormRemoteSource.java b/collect_app/src/main/java/org/fieldsight/naxa/generalforms/data/GeneralFormRemoteSource.java index 25b727fc3..121d18af5 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/generalforms/data/GeneralFormRemoteSource.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/generalforms/data/GeneralFormRemoteSource.java @@ -3,7 +3,6 @@ import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; -import org.odk.collect.android.application.Collect; import org.fieldsight.naxa.common.BaseRemoteDataSource; import org.fieldsight.naxa.common.Constant; import org.fieldsight.naxa.common.database.FieldSightConfigDatabase; @@ -17,6 +16,7 @@ import org.fieldsight.naxa.project.data.ProjectLocalSource; import org.fieldsight.naxa.sync.SyncRepository; import org.greenrobot.eventbus.EventBus; +import org.odk.collect.android.application.Collect; import java.io.IOException; import java.lang.reflect.Type; @@ -41,8 +41,7 @@ public class GeneralFormRemoteSource implements BaseRemoteDataSource { private static GeneralFormRemoteSource INSTANCE; - private ProjectLocalSource projectLocalSource; - private SyncRepository syncRepository; + private final ProjectLocalSource projectLocalSource; public static GeneralFormRemoteSource getInstance() { if (INSTANCE == null) { @@ -54,7 +53,7 @@ public static GeneralFormRemoteSource getInstance() { public GeneralFormRemoteSource() { this.projectLocalSource = ProjectLocalSource.getInstance(); - this.syncRepository = SyncRepository.getInstance(); + } diff --git a/collect_app/src/main/java/org/fieldsight/naxa/generalforms/data/GetResponce.java b/collect_app/src/main/java/org/fieldsight/naxa/generalforms/data/GetResponce.java index e14ee6d0e..8765482eb 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/generalforms/data/GetResponce.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/generalforms/data/GetResponce.java @@ -3,7 +3,6 @@ import android.os.Parcel; import android.os.Parcelable; -import com.google.gson.Gson; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; diff --git a/collect_app/src/main/java/org/fieldsight/naxa/login/BaseLoginActivity.java b/collect_app/src/main/java/org/fieldsight/naxa/login/BaseLoginActivity.java index 0125cbefe..3b68aee32 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/login/BaseLoginActivity.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/login/BaseLoginActivity.java @@ -4,9 +4,10 @@ import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; -import androidx.annotation.NonNull; import android.util.Log; +import androidx.annotation.NonNull; + import com.google.android.gms.auth.api.signin.GoogleSignIn; import com.google.android.gms.auth.api.signin.GoogleSignInAccount; import com.google.android.gms.auth.api.signin.GoogleSignInClient; @@ -16,13 +17,9 @@ import com.google.android.gms.tasks.Task; import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeTokenRequest; import com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets; -import com.google.api.client.googleapis.auth.oauth2.GoogleCredential; -import com.google.api.client.googleapis.auth.oauth2.GoogleIdToken; import com.google.api.client.googleapis.auth.oauth2.GoogleTokenResponse; import com.google.api.client.http.javanet.NetHttpTransport; import com.google.api.client.json.jackson2.JacksonFactory; -import com.google.api.services.drive.Drive; -import com.google.api.services.drive.model.File; import org.fieldsight.collect.android.R; import org.odk.collect.android.activities.CollectAbstractActivity; @@ -120,7 +117,7 @@ public void updateUI(GoogleSignInAccount account) { private class GetAccessTokenTask extends AsyncTask { - private ProgressDialog pd; + @Override protected GoogleTokenResponse doInBackground(String... urls) { @@ -157,7 +154,7 @@ protected void onPostExecute(GoogleTokenResponse tokenResponse) { gmailLoginFailed("Unable to get Gmail auth TOKEN"); }else { gmailLoginSuccess(tokenResponse.getAccessToken(), username); - Log.d(TAG, "onPostExecute: accessToken " + tokenResponse.getAccessToken()); + Timber.d("onPostExecute: accessToken " + tokenResponse.getAccessToken()); } diff --git a/collect_app/src/main/java/org/fieldsight/naxa/login/LoginActivity.java b/collect_app/src/main/java/org/fieldsight/naxa/login/LoginActivity.java index 3e2638f6e..dfbe7d8bd 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/login/LoginActivity.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/login/LoginActivity.java @@ -8,7 +8,6 @@ import android.content.Intent; import android.net.Uri; import android.os.Bundle; -import android.os.Handler; import android.view.View; import android.view.View.OnClickListener; import android.view.inputmethod.InputMethodManager; @@ -50,7 +49,7 @@ public class LoginActivity extends BaseLoginActivity implements LoginView { private LoginPresenter loginPresenter; private Button mEmailSignInButton; - private RelativeLayout rootLayout; + private ImageButton btnChangeUrl; private SignInButton btnGmailLogin; private boolean isFromGooleSignin = false; @@ -63,7 +62,6 @@ protected void onCreate(Bundle savedInstanceState) { mEmailView = findViewById(R.id.email); mPasswordView = findViewById(R.id.password); - rootLayout = findViewById(R.id.root_layout_activity_login); btnChangeUrl = findViewById(R.id.btn_change_server_url); mEmailSignInButton = findViewById(R.id.email_sign_in_button); 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 30675f2c4..a6a4267ce 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 @@ -3,9 +3,8 @@ import android.text.TextUtils; import org.fieldsight.collect.android.R; -import org.fieldsight.naxa.common.SharedPreferenceUtils; -import org.odk.collect.android.application.Collect; import org.fieldsight.naxa.common.FieldSightUserSession; +import org.fieldsight.naxa.common.SharedPreferenceUtils; import org.fieldsight.naxa.common.exception.FirebaseTokenException; import org.fieldsight.naxa.common.rx.RetrofitException; import org.fieldsight.naxa.firebase.FCMParameter; @@ -13,6 +12,7 @@ import org.fieldsight.naxa.network.APIEndpoint; import org.fieldsight.naxa.network.ApiInterface; import org.fieldsight.naxa.network.ServiceGenerator; +import org.odk.collect.android.application.Collect; import javax.net.ssl.SSLException; @@ -22,8 +22,6 @@ import io.reactivex.functions.Function; import io.reactivex.observers.DisposableObserver; import io.reactivex.schedulers.Schedulers; -import okhttp3.internal.Util; -import retrofit2.Retrofit; import timber.log.Timber; public class LoginModelImpl implements LoginModel { diff --git a/collect_app/src/main/java/org/fieldsight/naxa/login/LoginPresenterImpl.java b/collect_app/src/main/java/org/fieldsight/naxa/login/LoginPresenterImpl.java index 1192edff8..52c25f4eb 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/login/LoginPresenterImpl.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/login/LoginPresenterImpl.java @@ -18,8 +18,8 @@ public class LoginPresenterImpl implements LoginPresenter, LoginModel.OnLoginFinishedListener { - private LoginView loginView; - private LoginModel loginModel; + private final LoginView loginView; + private final LoginModel loginModel; public LoginPresenterImpl(LoginView loginView) { this.loginView = loginView; diff --git a/collect_app/src/main/java/org/fieldsight/naxa/login/model/SiteBuilder.java b/collect_app/src/main/java/org/fieldsight/naxa/login/model/SiteBuilder.java index 38fbea398..af57d348f 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/login/model/SiteBuilder.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/login/model/SiteBuilder.java @@ -175,6 +175,10 @@ public SiteBuilder setSiteDocuments(List siteDocuments) { return this; } + public Parcel getIn() { + return in; + } + public Site createSite() { return new Site(id, latitude, longitude, identifier, name, typeId, typeLabel, phone, address, publicDesc, additionalDesc, logo, isActive, location, diff --git a/collect_app/src/main/java/org/fieldsight/naxa/migrate/MigrateFieldSightActivity.java b/collect_app/src/main/java/org/fieldsight/naxa/migrate/MigrateFieldSightActivity.java index ea1fefa32..70e5c6ab5 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/migrate/MigrateFieldSightActivity.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/migrate/MigrateFieldSightActivity.java @@ -50,8 +50,6 @@ public class MigrateFieldSightActivity extends CollectAbstractActivity { @BindView(R.id.fieldsight_migrate_act_error_card) CardView cardViewError; - final Integer errorOccured = -1; - private final Integer max = 3; private Observable migration; private final int MAX_PROGRESS = 8; 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 31633600a..532286677 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 @@ -32,14 +32,14 @@ public class MigrateFieldSightViewModel extends ViewModel { - private MutableLiveData> oldAccounts = new MutableLiveData<>(); + private final MutableLiveData> oldAccounts = new MutableLiveData<>(); private String usernameOrEmail = null; private MigrationHelper migrationHelper; private void copyProjects() { SQLiteDatabase db = getProjSiteDB(); - Cursor cursor = null; + Cursor cursor; cursor = selectAll(db, MigrationHelper.Table.PROJECT); ArrayList projects = new ArrayList<>(); diff --git a/collect_app/src/main/java/org/fieldsight/naxa/notificationslist/NotificationImageAdapter.java b/collect_app/src/main/java/org/fieldsight/naxa/notificationslist/NotificationImageAdapter.java index 50d139578..ad9e2960e 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/notificationslist/NotificationImageAdapter.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/notificationslist/NotificationImageAdapter.java @@ -17,7 +17,7 @@ public class NotificationImageAdapter extends RecyclerView.Adapter implements View.OnClickListener { - private List items; + private final List items; private OnItemClickListener onItemClickListener; diff --git a/collect_app/src/main/java/org/fieldsight/naxa/notificationslist/NotificationListActivity.java b/collect_app/src/main/java/org/fieldsight/naxa/notificationslist/NotificationListActivity.java index fd3bc15c6..748477c3d 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/notificationslist/NotificationListActivity.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/notificationslist/NotificationListActivity.java @@ -81,7 +81,7 @@ public class NotificationListActivity extends CollectAbstractActivity implements boolean isOlderLoading = false; private NotificationListViewModel viewModel; private NotificationsAdapter adapter; - private int count; + final String latest_notification = "2"; // notification type when the user scroll down final String older_notification = "1"; // notification type when the user scrolls up List mNotificationList = new ArrayList<>(); diff --git a/collect_app/src/main/java/org/fieldsight/naxa/notificationslist/NotificationListViewModel.java b/collect_app/src/main/java/org/fieldsight/naxa/notificationslist/NotificationListViewModel.java index 25cde52c5..1d7b96904 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/notificationslist/NotificationListViewModel.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/notificationslist/NotificationListViewModel.java @@ -12,7 +12,7 @@ public class NotificationListViewModel extends ViewModel { - private MutableLiveData hasListData = new MutableLiveData(); + private final MutableLiveData hasListData = new MutableLiveData(); public MutableLiveData> fieldSightNoticationLiveData = new MutableLiveData<>(); diff --git a/collect_app/src/main/java/org/fieldsight/naxa/onboarding/CheckedItem.java b/collect_app/src/main/java/org/fieldsight/naxa/onboarding/CheckedItem.java index 9d5a24132..390737ae7 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/onboarding/CheckedItem.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/onboarding/CheckedItem.java @@ -22,7 +22,6 @@ public class CheckedItem extends RelativeLayout implements Checkable { private TextView tvSubtitle; private ProgressBar progressBar; private int sucessColor, failureColor, progressColor; - private boolean isIndeterminate = true; public CheckedItem(Context context, AttributeSet attrs, int defStyle) { 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 277e137f2..976df3f9f 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 @@ -24,7 +24,7 @@ public class DownloadListAdapter extends RecyclerView.Adapter { private final SyncRepository syncRepository; - private ArrayList syncableItems; + private final ArrayList syncableItems; private int selectedItemCount = 0; public DownloadListAdapter(ArrayList syncableItems) { diff --git a/collect_app/src/main/java/org/fieldsight/naxa/onboarding/DownloadPresenterImpl.java b/collect_app/src/main/java/org/fieldsight/naxa/onboarding/DownloadPresenterImpl.java index 376598d7a..a86bd0031 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/onboarding/DownloadPresenterImpl.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/onboarding/DownloadPresenterImpl.java @@ -28,16 +28,14 @@ import static org.fieldsight.naxa.common.Constant.DownloadUID.PREV_SUBMISSION; import static org.fieldsight.naxa.common.Constant.DownloadUID.SITE_TYPES; - +@Deprecated public class DownloadPresenterImpl implements DownloadPresenter { - private DownloadView downloadView; - private DownloadModel downloadModel; - private SyncRepository syncRepository; - private MutableLiveData isDownloading = new MutableLiveData<>(); + private final DownloadModel downloadModel; + private final SyncRepository syncRepository; public DownloadPresenterImpl(DownloadView downloadView) { - this.downloadView = downloadView; + this.downloadModel = new DownloadModelImpl(); syncRepository = SyncRepository.getInstance(); diff --git a/collect_app/src/main/java/org/fieldsight/naxa/onboarding/DownloadProgress.java b/collect_app/src/main/java/org/fieldsight/naxa/onboarding/DownloadProgress.java index a17ddd76f..2f4d1bc2d 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/onboarding/DownloadProgress.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/onboarding/DownloadProgress.java @@ -9,11 +9,11 @@ public class DownloadProgress implements Serializable { public static final int STATUS_PROGRESS_UPDATE = 2; public static final int STATUS_FINISHED_FORM = 3; - private String currentFile; - private int progress; + private final String currentFile; + private final int progress; private int total; private String message; - private boolean isIndeterminate; + private final boolean isIndeterminate; public DownloadProgress(String currentFile, int progress, int total, String message, boolean isIndeterminate) { this.currentFile = currentFile; diff --git a/collect_app/src/main/java/org/fieldsight/naxa/onboarding/DownloadableItemsDiffCallback.java b/collect_app/src/main/java/org/fieldsight/naxa/onboarding/DownloadableItemsDiffCallback.java index 20949bae0..ecbff8def 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/onboarding/DownloadableItemsDiffCallback.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/onboarding/DownloadableItemsDiffCallback.java @@ -7,10 +7,11 @@ import java.util.List; +@Deprecated public class DownloadableItemsDiffCallback extends DiffUtil.Callback { - private List oldItems; - private List newItems; + private final List oldItems; + private final List newItems; public DownloadableItemsDiffCallback(List newItems, List oldItems) { diff --git a/collect_app/src/main/java/org/fieldsight/naxa/onboarding/XMLForm.java b/collect_app/src/main/java/org/fieldsight/naxa/onboarding/XMLForm.java index c2c3a8542..0c94ccca4 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/onboarding/XMLForm.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/onboarding/XMLForm.java @@ -6,10 +6,10 @@ */ public class XMLForm { - private String formCreatorsId; - private boolean isCreatedFromProject; - private String downloadUrl; - private String title; + private final String formCreatorsId; + private final boolean isCreatedFromProject; + private final String downloadUrl; + private final String title; public String getTitle() { return title; 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 b7679882d..ac157a045 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 @@ -77,7 +77,6 @@ public class XMLFormDownloadService extends IntentService implements DownloadFor private Bundle message; private ResultReceiver receiver; - private DownloadProgress downloadProgress; public static void start(Context context, @NonNull XMLFormDownloadReceiver receiver) { diff --git a/collect_app/src/main/java/org/fieldsight/naxa/previoussubmission/LastSubmissionLocalSource.java b/collect_app/src/main/java/org/fieldsight/naxa/previoussubmission/LastSubmissionLocalSource.java index a4c90886b..b33b6888b 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/previoussubmission/LastSubmissionLocalSource.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/previoussubmission/LastSubmissionLocalSource.java @@ -16,7 +16,7 @@ public class LastSubmissionLocalSource implements BaseLocalDataSource { private static LastSubmissionLocalSource INSTANCE; - private SubmissionDetailDAO dao; + private final SubmissionDetailDAO dao; private LastSubmissionLocalSource() { diff --git a/collect_app/src/main/java/org/fieldsight/naxa/profile/UserProfileViewModel.java b/collect_app/src/main/java/org/fieldsight/naxa/profile/UserProfileViewModel.java index e9beb4e89..a6a379bb8 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/profile/UserProfileViewModel.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/profile/UserProfileViewModel.java @@ -14,11 +14,11 @@ public class UserProfileViewModel extends ViewModel { - private UserProfileRepository userProfileRepository; - private MutableLiveData user = new MutableLiveData<>(); - private MutableLiveData syncLiveData = new MutableLiveData<>(); - private MutableLiveData editProfile = new MutableLiveData<>(); - private MutableLiveData progressBar = new MutableLiveData<>(); + private final UserProfileRepository userProfileRepository; + private final MutableLiveData user = new MutableLiveData<>(); + private final MutableLiveData syncLiveData = new MutableLiveData<>(); + private final MutableLiveData editProfile = new MutableLiveData<>(); + private final MutableLiveData progressBar = new MutableLiveData<>(); public UserProfileViewModel() { this.userProfileRepository = new UserProfileRepository(); diff --git a/collect_app/src/main/java/org/fieldsight/naxa/project/ProjectsDiffCallback.java b/collect_app/src/main/java/org/fieldsight/naxa/project/ProjectsDiffCallback.java index e71270135..0d45ca391 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/project/ProjectsDiffCallback.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/project/ProjectsDiffCallback.java @@ -9,8 +9,8 @@ public class ProjectsDiffCallback extends DiffUtil.Callback { - private List oldProjects; - private List newProjects; + private final List oldProjects; + private final List newProjects; public ProjectsDiffCallback(List newProjects, List oldProjects) { this.newProjects = newProjects; diff --git a/collect_app/src/main/java/org/fieldsight/naxa/project/adapter/MyProjectsAdapter.java b/collect_app/src/main/java/org/fieldsight/naxa/project/adapter/MyProjectsAdapter.java index 7229739d0..bdff67e0c 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/project/adapter/MyProjectsAdapter.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/project/adapter/MyProjectsAdapter.java @@ -23,16 +23,14 @@ public class MyProjectsAdapter extends RecyclerView.Adapter { - private List myProjectList; + private final List myProjectList; - private OnItemClickListener onItemClickListener; + private final OnItemClickListener onItemClickListener; public class MyViewHolder extends RecyclerView.ViewHolder { - private TextView title, organizationName; - private ImageView ivLogo; - - private RelativeLayout rootLayout; + private final TextView title, organizationName; + private final ImageView ivLogo; private MyViewHolder(View view) { @@ -40,15 +38,10 @@ private MyViewHolder(View view) { title = view.findViewById(R.id.tv_project_list_name); organizationName = view.findViewById(R.id.tv_organization_name); ivLogo = view.findViewById(R.id.iv_org_logo); - rootLayout = view.findViewById(R.id.project_list_item_root_layout); + RelativeLayout rootLayout = view.findViewById(R.id.project_list_item_root_layout); - rootLayout.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - onItemClickListener.onItemClick(myProjectList.get(getAdapterPosition())); - } - }); + rootLayout.setOnClickListener(v -> onItemClickListener.onItemClick(myProjectList.get(getAdapterPosition()))); } } diff --git a/collect_app/src/main/java/org/fieldsight/naxa/project/data/ProjectLocalSource.java b/collect_app/src/main/java/org/fieldsight/naxa/project/data/ProjectLocalSource.java index 18e031cd3..fc2a1a534 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/project/data/ProjectLocalSource.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/project/data/ProjectLocalSource.java @@ -17,7 +17,7 @@ public class ProjectLocalSource implements BaseLocalDataSource { private static ProjectLocalSource INSTANCE; - private ProjectDao dao; + private final ProjectDao dao; private ProjectLocalSource() { diff --git a/collect_app/src/main/java/org/fieldsight/naxa/project/data/ProjectRepository.java b/collect_app/src/main/java/org/fieldsight/naxa/project/data/ProjectRepository.java index e34a8c413..d388e720a 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/project/data/ProjectRepository.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/project/data/ProjectRepository.java @@ -43,7 +43,6 @@ public class ProjectRepository implements BaseRepository { private final ProjectLocalSource localSource; private final ProjectSitesRemoteSource remoteSource; - private MediatorLiveData> mediatorLiveData = new MediatorLiveData<>(); public static ProjectRepository getInstance() { return getInstance(ProjectLocalSource.getInstance(), ProjectSitesRemoteSource.getInstance()); diff --git a/collect_app/src/main/java/org/fieldsight/naxa/project/data/ProjectSitesRemoteSource.java b/collect_app/src/main/java/org/fieldsight/naxa/project/data/ProjectSitesRemoteSource.java index 8ac5d1686..c8a067e6c 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/project/data/ProjectSitesRemoteSource.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/project/data/ProjectSitesRemoteSource.java @@ -43,9 +43,8 @@ public class ProjectSitesRemoteSource implements BaseRemoteDataSource { private static ProjectSitesRemoteSource INSTANCE; - private SiteRepository siteRepository; - private ProjectLocalSource projectLocalSource; - private SyncRepository syncRepository; + private final SiteRepository siteRepository; + private final ProjectLocalSource projectLocalSource; public static ProjectSitesRemoteSource getInstance() { if (INSTANCE == null) { @@ -57,7 +56,7 @@ public static ProjectSitesRemoteSource getInstance() { public ProjectSitesRemoteSource() { siteRepository = SiteRepository.getInstance(SiteLocalSource.getInstance(), SiteRemoteSource.getInstance()); projectLocalSource = ProjectLocalSource.getInstance(); - syncRepository = SyncRepository.getInstance(); + } diff --git a/collect_app/src/main/java/org/fieldsight/naxa/project/data/ProjectViewModel.java b/collect_app/src/main/java/org/fieldsight/naxa/project/data/ProjectViewModel.java index 0eddeb234..c1aa58ffd 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/project/data/ProjectViewModel.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/project/data/ProjectViewModel.java @@ -9,7 +9,7 @@ public class ProjectViewModel extends ViewModel { - private ProjectRepository projectRepository; + private final ProjectRepository projectRepository; public ProjectViewModel(ProjectRepository projectRepository) { this.projectRepository = projectRepository; diff --git a/collect_app/src/main/java/org/fieldsight/naxa/scheduled/ScheduleFormsDiffCallback.java b/collect_app/src/main/java/org/fieldsight/naxa/scheduled/ScheduleFormsDiffCallback.java index b87c43108..f6dcf4d90 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/scheduled/ScheduleFormsDiffCallback.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/scheduled/ScheduleFormsDiffCallback.java @@ -13,8 +13,8 @@ public class ScheduleFormsDiffCallback extends DiffUtil.Callback { - private List oldScheduleForm; - private List newScheduleForm; + private final List oldScheduleForm; + private final List newScheduleForm; public ScheduleFormsDiffCallback(List oldScheduleForm, List newScheduleForm) { this.oldScheduleForm = oldScheduleForm; diff --git a/collect_app/src/main/java/org/fieldsight/naxa/scheduled/ScheduledFormsAdapter.java b/collect_app/src/main/java/org/fieldsight/naxa/scheduled/ScheduledFormsAdapter.java index e74c73d29..cddd5eba6 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/scheduled/ScheduledFormsAdapter.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/scheduled/ScheduledFormsAdapter.java @@ -36,9 +36,9 @@ public class ScheduledFormsAdapter extends RecyclerView.Adapter { - private ArrayList totalList; + private final ArrayList totalList; - private OnFormItemClickListener listener; + private final OnFormItemClickListener listener; public ScheduledFormsAdapter(ArrayList totalList, OnFormItemClickListener listener) { this.totalList = totalList; @@ -161,11 +161,11 @@ public ArrayList getAll() { public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { - private TextView tvFormName, tvDesc, tvIconText, tvSubtext; - private Button btnOpenEdu, btnOpenHistory; - private ImageView ivCardCircle; - private View cardView; - private ImageButton btnExpandCard; + private final TextView tvFormName, tvDesc, tvIconText, tvSubtext; + private final Button btnOpenEdu, btnOpenHistory; + private final ImageView ivCardCircle; + private final View cardView; + private final ImageButton btnExpandCard; public ViewHolder(View view) { super(view); diff --git a/collect_app/src/main/java/org/fieldsight/naxa/scheduled/data/ScheduledFormRepository.java b/collect_app/src/main/java/org/fieldsight/naxa/scheduled/data/ScheduledFormRepository.java index 379f8220a..1068370b4 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/scheduled/data/ScheduledFormRepository.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/scheduled/data/ScheduledFormRepository.java @@ -17,7 +17,6 @@ public class ScheduledFormRepository implements BaseRepository { private final ScheduledFormsLocalSource localSource; private final ScheduledFormsRemoteSource remoteSource; - private MediatorLiveData> mediatorLiveData = new MediatorLiveData<>(); public static ScheduledFormRepository getInstance(ScheduledFormsLocalSource localSource, ScheduledFormsRemoteSource remoteSource) { diff --git a/collect_app/src/main/java/org/fieldsight/naxa/scheduled/data/ScheduledFormsLocalSource.java b/collect_app/src/main/java/org/fieldsight/naxa/scheduled/data/ScheduledFormsLocalSource.java index a27b656af..f5bee3c6e 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/scheduled/data/ScheduledFormsLocalSource.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/scheduled/data/ScheduledFormsLocalSource.java @@ -32,7 +32,7 @@ public class ScheduledFormsLocalSource implements BaseLocalDataSource { private static ScheduledFormsLocalSource INSTANCE; - private ScheduledFormDAO dao; + private final ScheduledFormDAO dao; private ScheduledFormsLocalSource() { FieldSightDatabase database = FieldSightDatabase.getDatabase(Collect.getInstance());//todo inject context diff --git a/collect_app/src/main/java/org/fieldsight/naxa/scheduled/data/ScheduledFormsRemoteSource.java b/collect_app/src/main/java/org/fieldsight/naxa/scheduled/data/ScheduledFormsRemoteSource.java index b1d09115a..b813346d7 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/scheduled/data/ScheduledFormsRemoteSource.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/scheduled/data/ScheduledFormsRemoteSource.java @@ -40,8 +40,8 @@ public class ScheduledFormsRemoteSource implements BaseRemoteDataSource { private static ScheduledFormsRemoteSource INSTANCE; - private ProjectLocalSource projectLocalSource; - private SyncRepository syncRepository; + private final ProjectLocalSource projectLocalSource; + private final SyncRepository syncRepository; public static ScheduledFormsRemoteSource getInstance() { diff --git a/collect_app/src/main/java/org/fieldsight/naxa/site/SearchAdapter.java b/collect_app/src/main/java/org/fieldsight/naxa/site/SearchAdapter.java index 657612dab..7ca7a87f5 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/site/SearchAdapter.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/site/SearchAdapter.java @@ -15,21 +15,20 @@ public class SearchAdapter extends BaseAdapter { - private Context mContext; + private final Context mContext; private List siteList; private LayoutInflater mLayoutInflater; - private boolean mIsFilterList; public SearchAdapter(Context context, List siteList, boolean isFilterList) { this.mContext = context; this.siteList = siteList; - this.mIsFilterList = isFilterList; + } public void updateList(List filterList, boolean isFilterList) { this.siteList = filterList; - this.mIsFilterList = isFilterList; + notifyDataSetChanged(); } 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 073e927c4..19b591061 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 @@ -19,9 +19,9 @@ public class SiteClusterSpinnerAdapter extends ArrayAdapter { - private Context context; + private final Context context; - private List values; + private final List values; SiteClusterSpinnerAdapter(Context context, int textViewResourceId, String hint, List values) { super(context, textViewResourceId, values); 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 cb52d65d6..f0efc7fbd 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 @@ -94,7 +94,7 @@ public class SiteDashboardFragment extends Fragment implements View.OnClickListe private TextView tvSiteType; private Unbinder unbinder; private View rootView; - private LiveData siteLiveData; + boolean isParent = false; public SiteDashboardFragment() { diff --git a/collect_app/src/main/java/org/fieldsight/naxa/site/SiteInfoWindow.java b/collect_app/src/main/java/org/fieldsight/naxa/site/SiteInfoWindow.java index 719246d93..d4de83f3a 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/site/SiteInfoWindow.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/site/SiteInfoWindow.java @@ -4,7 +4,6 @@ import android.widget.TextView; import org.fieldsight.collect.android.R; -import org.odk.collect.android.application.Collect; import org.fieldsight.naxa.login.model.Site; import org.osmdroid.views.MapView; import org.osmdroid.views.overlay.infowindow.InfoWindow; diff --git a/collect_app/src/main/java/org/fieldsight/naxa/site/SiteListAdapter.java b/collect_app/src/main/java/org/fieldsight/naxa/site/SiteListAdapter.java index 1ed02f62d..32ef37711 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/site/SiteListAdapter.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/site/SiteListAdapter.java @@ -27,7 +27,7 @@ public class SiteListAdapter extends RecyclerView.Adapter siteList; - private final List filetredsitelist; + private final SparseBooleanArray selectedItems; private final SparseBooleanArray animationItemsIndex; private final SiteListAdapter.SiteListAdapterListener listener; @@ -48,7 +48,7 @@ public class SiteListAdapter extends RecyclerView.Adapter getAll() { public class SurveyViewHolder extends RecyclerView.ViewHolder { - private RelativeLayout rootLayout; + private final RelativeLayout rootLayout; SurveyViewHolder(View itemView) { super(itemView); @@ -187,10 +187,10 @@ public void onClick(View view) { } public class SiteViewHolder extends RecyclerView.ViewHolder implements View.OnLongClickListener, View.OnClickListener { - private TextView siteName, identifier, message, iconText, offlinetag; - private ImageView imgProfile; - private RelativeLayout iconContainer, iconBack, iconFront; - private View rootLayout; + private final TextView siteName, identifier, message, iconText, offlinetag; + private final ImageView imgProfile; + private final RelativeLayout iconContainer, iconBack, iconFront; + private final View rootLayout; SiteViewHolder(View view) { super(view); 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 e60be392f..76483c8e5 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 @@ -82,11 +82,9 @@ public class SiteListFragment extends Fragment implements SiteListAdapter.SiteLi private LiveData> allSitesLiveData; private LiveData> offlineSitesLiveData; private BottomSheetDialog bottomSheetDialog; - private FilterOption.FilterType selectedFilter; private ActionMode actionMode; private SiteUploadActionModeCallback siteUploadActionModeCallback; - private LiveData> filteredSiteLiveData; private MenuItem sortActionFilter; TermsLabels tl = null; @@ -347,11 +345,10 @@ public void onError(Throwable e) { } - protected FilterOption.FilterType getSelectedFilter() { - if (selectedFilter == null) { - return FilterOption.FilterType.ALL_SITES; - } - return selectedFilter; + private FilterOption.FilterType getSelectedFilter() { + + return FilterOption.FilterType.ALL_SITES; + } @Override @@ -401,7 +398,7 @@ private void showSubSiteDialog(List subsiteList) { @Override public void onSurveyFormClicked() { - FragmentHostActivity.startWithSurveyForm(requireActivity(),loadedProject); + FragmentHostActivity.startWithSurveyForm(requireActivity(), loadedProject); } diff --git a/collect_app/src/main/java/org/fieldsight/naxa/site/SiteTypeLocalSource.java b/collect_app/src/main/java/org/fieldsight/naxa/site/SiteTypeLocalSource.java index f4be975fb..c9b0974b1 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/site/SiteTypeLocalSource.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/site/SiteTypeLocalSource.java @@ -15,7 +15,7 @@ public class SiteTypeLocalSource implements BaseLocalDataSource { private static SiteTypeLocalSource INSTANCE; - private SiteTypeDAO dao; + private final SiteTypeDAO dao; private SiteTypeLocalSource() { 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 751fee92e..1d44e3954 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 @@ -17,9 +17,9 @@ public class SiteTypeSpinnerAdapter extends ArrayAdapter { - private Context context; + private final Context context; - private List values; + private final List values; public SiteTypeSpinnerAdapter(Context context, int textViewResourceId, String hint, List values) { super(context, textViewResourceId, values); 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 01094bbc8..34569103d 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 @@ -26,7 +26,7 @@ public class SiteLocalSource implements BaseLocalDataSource { private static SiteLocalSource INSTANCE; - private SiteDao dao; + private final SiteDao dao; private 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 80526a522..e21afa852 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 @@ -46,7 +46,6 @@ public class SiteRemoteSource implements BaseRemoteDataSource { private static SiteRemoteSource INSTANCE; - private SiteDao dao; public static SiteRemoteSource getInstance() { diff --git a/collect_app/src/main/java/org/fieldsight/naxa/site/db/SiteRepository.java b/collect_app/src/main/java/org/fieldsight/naxa/site/db/SiteRepository.java index f08008ddc..7b7c9c545 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/site/db/SiteRepository.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/site/db/SiteRepository.java @@ -23,7 +23,7 @@ public class SiteRepository implements BaseRepository { private static SiteRepository INSTANCE = null; private final SiteLocalSource localSource; - private final SiteRemoteSource remoteSource; + public static SiteRepository getInstance(SiteLocalSource localSource, SiteRemoteSource remoteSource) { @@ -40,7 +40,7 @@ public static SiteRepository getInstance(SiteLocalSource localSource, SiteRemote private SiteRepository(@NonNull SiteLocalSource localSource, @NonNull SiteRemoteSource remoteSource) { this.localSource = localSource; - this.remoteSource = remoteSource; + } public List searchSites(String searchQuery,String projectId) { diff --git a/collect_app/src/main/java/org/fieldsight/naxa/site/db/SiteUploadHistoryLocalSource.java b/collect_app/src/main/java/org/fieldsight/naxa/site/db/SiteUploadHistoryLocalSource.java index f1d7acd80..b9bdbf1f5 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/site/db/SiteUploadHistoryLocalSource.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/site/db/SiteUploadHistoryLocalSource.java @@ -19,7 +19,7 @@ public class SiteUploadHistoryLocalSource implements BaseLocalDataSource { public static SiteUploadHistoryLocalSource INSTANCE; - private SiteUploadHistoryDAO dao; + private final SiteUploadHistoryDAO dao; public static SiteUploadHistoryLocalSource getInstance() { if (INSTANCE == null) { diff --git a/collect_app/src/main/java/org/fieldsight/naxa/site/db/SiteViewModel.java b/collect_app/src/main/java/org/fieldsight/naxa/site/db/SiteViewModel.java deleted file mode 100644 index 6bbf80cdf..000000000 --- a/collect_app/src/main/java/org/fieldsight/naxa/site/db/SiteViewModel.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.fieldsight.naxa.site.db; - - -import android.app.Application; - - -import androidx.annotation.NonNull; -import androidx.lifecycle.AndroidViewModel; -import androidx.lifecycle.LiveData; - -import org.fieldsight.naxa.login.model.Project; -import org.fieldsight.naxa.login.model.Site; - -import java.util.List; - -public class SiteViewModel extends AndroidViewModel { - - private SiteRepository mSiteRepository; - private List mAllSites; - - public SiteViewModel(@NonNull Application application) { - super(application); - this.mSiteRepository = SiteRepository.getInstance(SiteLocalSource.getInstance(), SiteRemoteSource.getInstance()); - - } - - public List searchSites(String searchQuery,String projectId) { - return mSiteRepository.searchSites(searchQuery,projectId); - } - - public LiveData> getSiteByProject(Project project) { - return mSiteRepository.getSiteByProjectId(project.getId()); - } - - - public void insertSitesAsVerified(Site site, Project project) { - mSiteRepository.saveSitesAsVerified(site, project); - } - - -} diff --git a/collect_app/src/main/java/org/fieldsight/naxa/stages/StageListAdapter.java b/collect_app/src/main/java/org/fieldsight/naxa/stages/StageListAdapter.java index 7dd97c597..3bbf01d09 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/stages/StageListAdapter.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/stages/StageListAdapter.java @@ -20,8 +20,8 @@ public class StageListAdapter extends RecyclerView.Adapter implements View.OnClickListener { - private ArrayList totalList; - public OnFormItemClickListener onFormItemClickListener; + private final ArrayList totalList; + public final OnFormItemClickListener onFormItemClickListener; public StageListAdapter(ArrayList totalList, OnFormItemClickListener onFormItemClickListener) { 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 566fafc47..17d105bdd 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 @@ -55,7 +55,6 @@ public class StageListFragment extends Fragment implements OnFormItemClickListen private Site loadedSite; Unbinder unbinder; - private StageViewModel viewModel; @BindView(R.id.root_layout_empty_layout) public LinearLayout emptyLayout; @@ -86,9 +85,6 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c inflater.inflate(R.layout.general_forms_list_fragment, container, false); unbinder = ButterKnife.bind(this, rootView); - ViewModelFactory factory = ViewModelFactory.getInstance(getActivity().getApplication()); - - viewModel = ViewModelProviders.of(getActivity(), factory).get(StageViewModel.class); setToolbarText(); return rootView; diff --git a/collect_app/src/main/java/org/fieldsight/naxa/stages/StagesDiffCallback.java b/collect_app/src/main/java/org/fieldsight/naxa/stages/StagesDiffCallback.java index 0e4f87f83..b7d3c0767 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/stages/StagesDiffCallback.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/stages/StagesDiffCallback.java @@ -13,8 +13,8 @@ public class StagesDiffCallback extends DiffUtil.Callback { - private List oldStages; - private List newStages; + private final List oldStages; + private final List newStages; public StagesDiffCallback(List newStages, List oldStages) { diff --git a/collect_app/src/main/java/org/fieldsight/naxa/stages/data/Stage.java b/collect_app/src/main/java/org/fieldsight/naxa/stages/data/Stage.java index 86d0b50c3..27206a959 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/stages/data/Stage.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/stages/data/Stage.java @@ -1,5 +1,7 @@ package org.fieldsight.naxa.stages.data; +import android.text.TextUtils; + import androidx.annotation.NonNull; import androidx.room.Entity; import androidx.room.Ignore; @@ -8,6 +10,7 @@ import com.google.gson.annotations.SerializedName; import org.fieldsight.naxa.common.Constant; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; @@ -85,11 +88,15 @@ public Stage(String id, Integer projectStageId, ArrayList subStage, St } - public String getFormDeployedFrom() { - return project != null ? Constant.FormDeploymentFrom.PROJECT : Constant.FormDeploymentFrom.SITE; + public String getFormDeployedFrom(){ + if(TextUtils.isEmpty(formDeployedFrom)){ + return project != null ? Constant.FormDeploymentFrom.PROJECT : Constant.FormDeploymentFrom.SITE; + } + return formDeployedFrom; } - public void setFormDeployedFrom(String formDeployedFrom) { + + public void setFormDeployedFrom(@NotNull String formDeployedFrom) { this.formDeployedFrom = formDeployedFrom; } diff --git a/collect_app/src/main/java/org/fieldsight/naxa/stages/data/StageLocalSource.java b/collect_app/src/main/java/org/fieldsight/naxa/stages/data/StageLocalSource.java index 636341966..9365664da 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/stages/data/StageLocalSource.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/stages/data/StageLocalSource.java @@ -24,7 +24,7 @@ public class StageLocalSource implements BaseLocalDataSource { private static StageLocalSource INSTANCE; - private StageFormDAO dao; + private final StageFormDAO dao; private StageLocalSource() { FieldSightDatabase database = FieldSightDatabase.getDatabase(Collect.getInstance());//todo inject context diff --git a/collect_app/src/main/java/org/fieldsight/naxa/stages/data/StageRemoteSource.java b/collect_app/src/main/java/org/fieldsight/naxa/stages/data/StageRemoteSource.java index 6721f130c..8bace533d 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/stages/data/StageRemoteSource.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/stages/data/StageRemoteSource.java @@ -36,7 +36,7 @@ public class StageRemoteSource implements BaseRemoteDataSource { private static StageRemoteSource INSTANCE; - private SyncRepository syncRepository; + private final SyncRepository syncRepository; public static StageRemoteSource getInstance() { diff --git a/collect_app/src/main/java/org/fieldsight/naxa/submissions/MultiViewAdapter.java b/collect_app/src/main/java/org/fieldsight/naxa/submissions/MultiViewAdapter.java index 09cc96bbf..c3629b518 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/submissions/MultiViewAdapter.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/submissions/MultiViewAdapter.java @@ -13,6 +13,7 @@ import androidx.recyclerview.widget.RecyclerView; import org.fieldsight.collect.android.R; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; @@ -27,22 +28,16 @@ public class MultiViewAdapter extends RecyclerView.Adapter listOfItems; - private OnCardClickListener onCardClickListener; - private Context context; + private final ArrayList listOfItems; + + public MultiViewAdapter() { listOfItems = new ArrayList<>(); } - public MultiViewAdapter(ArrayList listOfItems) { - this.listOfItems = listOfItems; - } - - public List getListOfItems() { - return listOfItems; - } + @NotNull @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { RecyclerView.ViewHolder viewHolder = null; @@ -125,7 +120,7 @@ public ViewModel getItem(int position) { public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { final ViewModel result = listOfItems.get(position); - context = holder.itemView.getContext(); + Context context = holder.itemView.getContext(); switch (getItemViewType(position)) { case TEXT_DESC: @@ -174,7 +169,7 @@ public URLVH(View itemView) { } public void setOnCardClickListener(OnCardClickListener onCardClickListener) { - this.onCardClickListener = onCardClickListener; + } public interface OnCardClickListener { diff --git a/collect_app/src/main/java/org/fieldsight/naxa/submissions/PaginationAdapter.java b/collect_app/src/main/java/org/fieldsight/naxa/submissions/PaginationAdapter.java index 169749583..d995b685e 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/submissions/PaginationAdapter.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/submissions/PaginationAdapter.java @@ -27,12 +27,12 @@ public class PaginationAdapter extends RecyclerView.Adapter movies; - private Context context; + private List movies; + private final Context context; private boolean isLoadingAdded = false; public OnCardClickListener listener; - private boolean isLastPageFooterAdded = false; + public PaginationAdapter(Context context) { this.context = context; @@ -196,19 +196,15 @@ public FormResponse getItem(int position) { return movies.get(position); } - public void addLastPageFooter() { - isLastPageFooterAdded = true; - add(new FormResponse()); - } + protected class FormVH extends RecyclerView.ViewHolder { - private final CardView rootLayout; - private TextView tvTitle, tvSubmissionDateTime; + private final TextView tvTitle, tvSubmissionDateTime; public FormVH(View itemView) { super(itemView); - rootLayout = itemView.findViewById(R.id.card_view_item_recycler_view); + CardView rootLayout = itemView.findViewById(R.id.card_view_item_recycler_view); tvTitle = itemView.findViewById(R.id.item_text); tvSubmissionDateTime = itemView.findViewById(R.id.tv_item_submitted_by); } diff --git a/collect_app/src/main/java/org/fieldsight/naxa/submissions/PreviousSubmissionListActivity.java b/collect_app/src/main/java/org/fieldsight/naxa/submissions/PreviousSubmissionListActivity.java index 55f6c1cf9..f9444be19 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/submissions/PreviousSubmissionListActivity.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/submissions/PreviousSubmissionListActivity.java @@ -4,8 +4,6 @@ import android.content.Intent; import android.os.Bundle; import android.os.Handler; - -import android.view.Menu; import android.view.View; import android.view.animation.AnimationUtils; import android.view.animation.LayoutAnimationController; @@ -16,8 +14,6 @@ import androidx.appcompat.app.ActionBar; import androidx.appcompat.widget.Toolbar; import androidx.cardview.widget.CardView; -import androidx.core.app.ActivityCompat; -import androidx.core.app.ActivityOptionsCompat; import androidx.recyclerview.widget.DefaultItemAnimator; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -47,9 +43,8 @@ public class PreviousSubmissionListActivity extends CollectAbstractActivity implements PaginationAdapter.OnCardClickListener { - private static final String EXTRA_FORM_HISTORY = "org.bcss.collect.android.fieldsight.model.FormHistoryResponse"; ActionBar actionBar; - private String fsFormId, fsFormName, fsFormRecordName, siteId; + private String fsFormId, fsFormName, siteId; private LinearLayoutManager linearLayoutManager; private RecyclerView listFormHistory; private PaginationAdapter adapter; @@ -68,7 +63,7 @@ public class PreviousSubmissionListActivity extends CollectAbstractActivity impl private CardView cardSubmissionInfo; private TextView tvTotalSubmissionMessage; private TextView tvListTitle; - private Button btnLoadLatestSubmission; + private String tableName; FormResponse offlineLatestResponse; @@ -93,7 +88,7 @@ protected void onCreate(Bundle savedInstanceState) { Bundle bundle = getIntent().getExtras(); fsFormId = bundle.getString(Constant.BundleKey.KEY_FS_FORM_ID); fsFormName = bundle.getString(Constant.BundleKey.KEY_FS_FORM_NAME); - fsFormRecordName = bundle.getString(Constant.BundleKey.KEY_FS_FORM_RECORD_NAME); + siteId = bundle.getString(Constant.BundleKey.KEY_SITE_ID); tableName = bundle.getString(Constant.BundleKey.KEY_TABLE_NAME); @@ -339,7 +334,7 @@ private void bindUI() { cardSubmissionInfo = findViewById(R.id.card_info); tvTotalSubmissionMessage = findViewById(R.id.tv_total_submission_message); tvListTitle = findViewById(R.id.tv_list_title); - btnLoadLatestSubmission = findViewById(R.id.btn_load_prev_submissions); + } @Override diff --git a/collect_app/src/main/java/org/fieldsight/naxa/submissions/TitleDescModelDiffCallback.java b/collect_app/src/main/java/org/fieldsight/naxa/submissions/TitleDescModelDiffCallback.java index 316de377b..cfc481ac0 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/submissions/TitleDescModelDiffCallback.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/submissions/TitleDescModelDiffCallback.java @@ -12,8 +12,8 @@ public class TitleDescModelDiffCallback extends DiffUtil.Callback { - private List oldItems; - private List newItems; + private final List oldItems; + private final List newItems; public TitleDescModelDiffCallback(List newItems, List oldItems) { this.newItems = newItems; diff --git a/collect_app/src/main/java/org/fieldsight/naxa/submissions/ViewModel.java b/collect_app/src/main/java/org/fieldsight/naxa/submissions/ViewModel.java index b95ba6228..43d7d7af6 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/submissions/ViewModel.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/submissions/ViewModel.java @@ -14,10 +14,10 @@ public class ViewModel implements Parcelable { - private String name; - private String desc; - private String id; - private String secondaryId; + private final String name; + private final String desc; + private final String id; + private final String secondaryId; private String pictureUrl; public String getPictureUrl() { diff --git a/collect_app/src/main/java/org/fieldsight/naxa/substages/SubStageDiffCallback.java b/collect_app/src/main/java/org/fieldsight/naxa/substages/SubStageDiffCallback.java index c4b252735..7cfacdf22 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/substages/SubStageDiffCallback.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/substages/SubStageDiffCallback.java @@ -10,8 +10,8 @@ public class SubStageDiffCallback extends DiffUtil.Callback { - private List oldSubStages; - private List newSubStages; + private final List oldSubStages; + private final List newSubStages; public SubStageDiffCallback(List newSubStages, List oldSubStages) { 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 fdf9272b5..d52ed7ace 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 @@ -37,9 +37,9 @@ public class SubStageListAdapter extends RecyclerView.Adapter { - private List subStages; - private OnFormItemClickListener listener; - private String stageOrder; + private final List subStages; + private final OnFormItemClickListener listener; + private final String stageOrder; public SubStageListAdapter(List subStages, String stageOrder, OnFormItemClickListener listener) { @@ -170,11 +170,11 @@ public ArrayList getAll() { public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { - private TextView tvFormName, tvDesc, tvIconText, tvSubtext; - private Button btnOpenEdu, btnOpenHistory; - private ImageView ivCardCircle; - private CardView cardView; - private ImageButton btnExpandCard; + private final TextView tvFormName, tvDesc, tvIconText, tvSubtext; + private final Button btnOpenEdu, btnOpenHistory; + private final ImageView ivCardCircle; + private final CardView cardView; + private final ImageButton btnExpandCard; public ViewHolder(View view) { 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 fb6a5a5cc..e4e93a6e1 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 @@ -6,7 +6,6 @@ import android.database.Cursor; import android.database.CursorIndexOutOfBoundsException; import android.net.Uri; -import android.os.AsyncTask; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; @@ -30,17 +29,11 @@ import org.fieldsight.naxa.common.RecyclerViewEmptySupport; import org.fieldsight.naxa.common.SharedPreferenceUtils; import org.fieldsight.naxa.common.ViewModelFactory; -import org.fieldsight.naxa.common.event.DataSyncEvent; -import org.fieldsight.naxa.common.utilities.SnackBarUtils; -import org.fieldsight.naxa.educational.EducationalMaterialActivity; import org.fieldsight.naxa.forms.ui.EducationalMaterialListActivity; import org.fieldsight.naxa.login.model.Site; import org.fieldsight.naxa.previoussubmission.model.SubStageAndSubmission; import org.fieldsight.naxa.stages.data.SubStage; import org.fieldsight.naxa.submissions.PreviousSubmissionListActivity; -import org.greenrobot.eventbus.EventBus; -import org.greenrobot.eventbus.Subscribe; -import org.greenrobot.eventbus.ThreadMode; import org.odk.collect.android.application.Collect; import org.odk.collect.android.provider.FormsProviderAPI; import org.odk.collect.android.utilities.ToastUtils; @@ -56,9 +49,7 @@ import butterknife.ButterKnife; import butterknife.Unbinder; import io.reactivex.Observable; -import io.reactivex.Scheduler; import io.reactivex.android.schedulers.AndroidSchedulers; -import io.reactivex.functions.Consumer; import io.reactivex.schedulers.Schedulers; import timber.log.Timber; @@ -68,7 +59,6 @@ import static org.fieldsight.naxa.common.Constant.EXTRA_OBJECT; import static org.fieldsight.naxa.common.Constant.EXTRA_POSITION; import static org.fieldsight.naxa.common.SharedPreferenceUtils.isFormSaveCacheSafe; -import static org.fieldsight.naxa.generalforms.data.FormType.TABLE_GENERAL_FORM; import static org.fieldsight.naxa.helpers.FSInstancesDao.generateSubmissionUrl; public class SubStageListFragment extends Fragment implements OnFormItemClickListener { @@ -87,7 +77,6 @@ public class SubStageListFragment extends Fragment implements OnFormItemClickLis private SubStageListAdapter listAdapter; private Site loadedSite; - private String stageId; private String stagePosition; @@ -129,7 +118,7 @@ public SubStageListFragment() { public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); loadedSite = getArguments().getParcelable(EXTRA_OBJECT); - stageId = getArguments().getString(EXTRA_ID); + stagePosition = getArguments().getString(EXTRA_POSITION); substages = getArguments().getString("substages"); diff --git a/collect_app/src/main/java/org/fieldsight/naxa/substages/data/SubStageDAO.java b/collect_app/src/main/java/org/fieldsight/naxa/substages/data/SubStageDAO.java index 508ff4c34..947d58ef8 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/substages/data/SubStageDAO.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/substages/data/SubStageDAO.java @@ -4,7 +4,6 @@ import androidx.room.Dao; import androidx.room.Delete; import androidx.room.Query; -import androidx.room.RoomWarnings; import androidx.room.Transaction; import org.fieldsight.naxa.common.database.BaseDaoFieldSight; diff --git a/collect_app/src/main/java/org/fieldsight/naxa/substages/data/SubStageLocalSource.java b/collect_app/src/main/java/org/fieldsight/naxa/substages/data/SubStageLocalSource.java index 30654753f..305c7e282 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/substages/data/SubStageLocalSource.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/substages/data/SubStageLocalSource.java @@ -34,7 +34,7 @@ public class SubStageLocalSource implements BaseLocalDataSource { private static SubStageLocalSource INSTANCE; - private SubStageDAO dao; + private final SubStageDAO dao; private SubStageLocalSource() { diff --git a/collect_app/src/main/java/org/fieldsight/naxa/substages/data/SubStageRepository.java b/collect_app/src/main/java/org/fieldsight/naxa/substages/data/SubStageRepository.java index f2e6ced7d..97fd113c8 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/substages/data/SubStageRepository.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/substages/data/SubStageRepository.java @@ -17,7 +17,6 @@ public class SubStageRepository implements BaseLocalDataSource { private static SubStageRepository INSTANCE = null; private final SubStageLocalSource localSource; - private final StageRemoteSource remoteSource; public static SubStageRepository getInstance(SubStageLocalSource localSource, StageRemoteSource remoteSource) { if (INSTANCE == null) { @@ -33,7 +32,7 @@ public static SubStageRepository getInstance(SubStageLocalSource localSource, St private SubStageRepository(@NonNull SubStageLocalSource localSource, @NonNull StageRemoteSource remoteSource) { this.localSource = localSource; - this.remoteSource = remoteSource; + } diff --git a/collect_app/src/main/java/org/fieldsight/naxa/survey/SurveyFormLocalSource.java b/collect_app/src/main/java/org/fieldsight/naxa/survey/SurveyFormLocalSource.java index e48749a7f..2e5f09a0d 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/survey/SurveyFormLocalSource.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/survey/SurveyFormLocalSource.java @@ -14,7 +14,7 @@ public class SurveyFormLocalSource implements BaseLocalDataSource { private static SurveyFormLocalSource INSTANCE; - private SurveyFormDAO dao; + private final SurveyFormDAO dao; private SurveyFormLocalSource() { diff --git a/collect_app/src/main/java/org/fieldsight/naxa/survey/SurveyFormViewModel.java b/collect_app/src/main/java/org/fieldsight/naxa/survey/SurveyFormViewModel.java index 3b02d1fc3..b38d4a339 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/survey/SurveyFormViewModel.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/survey/SurveyFormViewModel.java @@ -8,7 +8,7 @@ import java.util.List; public class SurveyFormViewModel extends ViewModel { - private SurveyFormRepository repository; + private final SurveyFormRepository repository; public SurveyFormViewModel(SurveyFormRepository repository) { diff --git a/collect_app/src/main/java/org/fieldsight/naxa/survey/TitleDescAdapter.java b/collect_app/src/main/java/org/fieldsight/naxa/survey/TitleDescAdapter.java index 917d19b18..7a443ca17 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/survey/TitleDescAdapter.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/survey/TitleDescAdapter.java @@ -21,16 +21,14 @@ public class TitleDescAdapter extends RecyclerView.Adapter { - private ArrayList listOfItems; + private final ArrayList listOfItems; private OnCardClickListener onCardClickListener; public TitleDescAdapter() { listOfItems = new ArrayList<>(); } - public List getListOfItems() { - return listOfItems; - } + @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { 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 d72cb78c8..08727a178 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 @@ -62,7 +62,6 @@ public class DownloadViewModel extends ViewModel { - private final CompositeDisposable disposables = new CompositeDisposable(); public void queueSyncTask(List downloadableItems) { for (DownloadableItem downloadableItem : downloadableItems) { 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 cc08c767e..390b1ae46 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 @@ -29,7 +29,7 @@ public class DownloadableItemLocalSource implements BaseLocalDataSourceRX { private static DownloadableItemLocalSource INSTANCE; - private DownloadableItemDAO syncDAO; + private final DownloadableItemDAO syncDAO; public static DownloadableItemLocalSource getINSTANCE() { if (INSTANCE == null) { diff --git a/collect_app/src/main/java/org/fieldsight/naxa/sync/DownloadableItemsDiffCallbackNew.java b/collect_app/src/main/java/org/fieldsight/naxa/sync/DownloadableItemsDiffCallbackNew.java index 8919af293..19569aa16 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/sync/DownloadableItemsDiffCallbackNew.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/sync/DownloadableItemsDiffCallbackNew.java @@ -9,8 +9,8 @@ public class DownloadableItemsDiffCallbackNew extends DiffUtil.Callback { - private List oldItems; - private List newItems; + private final List oldItems; + private final List newItems; public DownloadableItemsDiffCallbackNew(List newItems, List oldItems) { 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 2a715f8e5..40a14e899 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 @@ -27,7 +27,7 @@ @Deprecated public class SyncRepository { - private SyncOLD syncOLD; + private final SyncOLD syncOLD; public static SyncRepository instance; private final String CHECKED = "checked"; public final String PROGRESS = "progress"; @@ -165,7 +165,7 @@ public void setAllRunningTaskAsFailed() { private static class insertAsyncTask extends AsyncTask { - private SyncOLD syncOLD; + private final SyncOLD syncOLD; insertAsyncTask(SyncOLD dao) { syncOLD = dao; diff --git a/collect_app/src/main/java/org/fieldsight/naxa/v3/adapter/ProjectListAdapter.java b/collect_app/src/main/java/org/fieldsight/naxa/v3/adapter/ProjectListAdapter.java index 29ea48ad8..ff0edc37d 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/v3/adapter/ProjectListAdapter.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/v3/adapter/ProjectListAdapter.java @@ -21,8 +21,8 @@ import timber.log.Timber; public class ProjectListAdapter extends RecyclerView.Adapter { - private List projectList; - boolean allTrue = false; + private final List projectList; + boolean allTrue; public ProjectListAdapter(List projectList, boolean allTrue) { this.projectList = projectList; 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 f49e97c24..1f9bb8b55 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 @@ -2,14 +2,10 @@ import android.util.Pair; -import androidx.room.ColumnInfo; - -import org.fieldsight.collect.android.BuildConfig; import org.fieldsight.collect.android.R; import org.fieldsight.naxa.common.FieldSightUserSession; import org.fieldsight.naxa.forms.data.local.FieldSightFormDetails; import org.fieldsight.naxa.forms.data.local.FieldsightFormDetailsv3; -import org.fieldsight.naxa.network.APIEndpoint; import org.odk.collect.android.application.Collect; import org.odk.collect.android.dao.FormsDao; import org.odk.collect.android.logic.FormDetails; @@ -25,7 +21,7 @@ public FieldSightFormDownloader(boolean isTempDownload) { super(isTempDownload); } - private String urlPrefix = FieldSightUserSession.getServerUrl(Collect.getInstance()); + private final String urlPrefix = FieldSightUserSession.getServerUrl(Collect.getInstance()); HashMap downloadFieldSightForms(List toDownload) { 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 539f2eda6..ccf9561d5 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 @@ -28,7 +28,9 @@ public class ProjectBuilder { private Parcel in; - + public Parcel getIn() { + return in; + } public ProjectBuilder setId(String id) { this.id = id; diff --git a/collect_app/src/main/java/org/fieldsight/naxa/v3/network/SyncLocalSource3.java b/collect_app/src/main/java/org/fieldsight/naxa/v3/network/SyncLocalSource3.java index b881c5b36..aea56438c 100644 --- a/collect_app/src/main/java/org/fieldsight/naxa/v3/network/SyncLocalSource3.java +++ b/collect_app/src/main/java/org/fieldsight/naxa/v3/network/SyncLocalSource3.java @@ -19,7 +19,7 @@ public class SyncLocalSource3 implements BaseLocalDataSource { private static SyncLocalSource3 INSTANCE; - private SyncDaoV3 dao; + private final SyncDaoV3 dao; private SyncLocalSource3() { 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 54bc8d5ba..88b05fdc0 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 @@ -52,8 +52,8 @@ public class SyncServiceV3 extends IntentService { ArrayList selectedProject; HashMap> selectedMap = null; - private List failedSiteUrls = new ArrayList<>(); - private ArrayList syncDisposable = new ArrayList<>(); + private final List failedSiteUrls = new ArrayList<>(); + private final ArrayList syncDisposable = new ArrayList<>(); int currentWorkingProjectIndex = 0; public SyncServiceV3() { 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 0cdb738e5..5f09daac6 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 @@ -13,9 +13,9 @@ public class Syncable implements Serializable { - private String title; + private final String title; boolean sync; // this flag is used to enable it to sync or not - private Set lastFailedUrl = new HashSet<>(); + private final Set lastFailedUrl = new HashSet<>(); private int total; private int progress; public int status; diff --git a/collect_app/src/main/java/org/odk/collect/android/activities/FileManagerTabs.java b/collect_app/src/main/java/org/odk/collect/android/activities/FileManagerTabs.java index a1886711d..eadaabc92 100644 --- a/collect_app/src/main/java/org/odk/collect/android/activities/FileManagerTabs.java +++ b/collect_app/src/main/java/org/odk/collect/android/activities/FileManagerTabs.java @@ -20,17 +20,16 @@ import android.view.MenuItem; import android.view.View; +import androidx.appcompat.widget.Toolbar; import androidx.fragment.app.Fragment; import androidx.viewpager.widget.ViewPager; -import androidx.appcompat.widget.Toolbar; import org.fieldsight.collect.android.R; import org.fieldsight.naxa.fragments.FSDataManagerList; +import org.fieldsight.naxa.login.model.Site; import org.odk.collect.android.adapters.ViewPagerAdapter; -import org.odk.collect.android.fragments.DataManagerList; import org.odk.collect.android.fragments.FormManagerList; import org.odk.collect.android.views.SlidingTabLayout; -import org.fieldsight.naxa.login.model.Site; import java.util.ArrayList; @@ -39,7 +38,6 @@ public class FileManagerTabs extends CollectAbstractActivity { // private final DataManagerList dataManagerList = DataManagerList.newInstance(); - private final FormManagerList formManagerList = FormManagerList.newInstance(); private Site loadedSite; diff --git a/collect_app/src/main/java/org/odk/collect/android/activities/InstanceChooserList.java b/collect_app/src/main/java/org/odk/collect/android/activities/InstanceChooserList.java index 996c922c3..8b140e62f 100644 --- a/collect_app/src/main/java/org/odk/collect/android/activities/InstanceChooserList.java +++ b/collect_app/src/main/java/org/odk/collect/android/activities/InstanceChooserList.java @@ -32,21 +32,19 @@ import androidx.loader.content.Loader; import org.fieldsight.collect.android.R; +import org.odk.collect.android.adapters.InstanceListCursorAdapter; import org.odk.collect.android.application.Collect; +import org.odk.collect.android.dao.InstancesDao; import org.odk.collect.android.listeners.DiskSyncListener; import org.odk.collect.android.listeners.PermissionListener; import org.odk.collect.android.provider.InstanceProviderAPI; import org.odk.collect.android.provider.InstanceProviderAPI.InstanceColumns; -import org.fieldsight.naxa.login.model.Site; -import org.odk.collect.android.adapters.InstanceListCursorAdapter; -import org.odk.collect.android.dao.InstancesDao; import org.odk.collect.android.tasks.InstanceSyncTask; import org.odk.collect.android.utilities.ApplicationConstants; import org.odk.collect.android.utilities.PermissionUtils; import timber.log.Timber; -import static org.fieldsight.naxa.common.Constant.EXTRA_OBJECT; import static org.odk.collect.android.utilities.PermissionUtils.finishAllActivities; /** diff --git a/collect_app/src/main/java/org/odk/collect/android/activities/InstanceUploaderListActivity.java b/collect_app/src/main/java/org/odk/collect/android/activities/InstanceUploaderListActivity.java index 8fcf33022..3ad5b7f05 100644 --- a/collect_app/src/main/java/org/odk/collect/android/activities/InstanceUploaderListActivity.java +++ b/collect_app/src/main/java/org/odk/collect/android/activities/InstanceUploaderListActivity.java @@ -89,7 +89,6 @@ public class InstanceUploaderListActivity extends InstanceListActivity implements OnLongClickListener, DiskSyncListener, AdapterView.OnItemClickListener, LoaderManager.LoaderCallbacks { private static final String SHOW_ALL_MODE = "showAllMode"; - private static final String FILTER_BY_SITE_MODE = "filterBySiteMode"; private static final String INSTANCE_UPLOADER_LIST_SORTING_ORDER = "instanceUploaderListSortingOrder"; public static final int INSTANCE_UPLOADER = 0; diff --git a/collect_app/src/main/java/org/odk/collect/android/application/ForceUpdateChecker.java b/collect_app/src/main/java/org/odk/collect/android/application/ForceUpdateChecker.java index 879b9d836..6af27af91 100644 --- a/collect_app/src/main/java/org/odk/collect/android/application/ForceUpdateChecker.java +++ b/collect_app/src/main/java/org/odk/collect/android/application/ForceUpdateChecker.java @@ -13,14 +13,13 @@ public class ForceUpdateChecker { - private static final String TAG = ForceUpdateChecker.class.getSimpleName(); public static final String KEY_UPDATE_REQUIRED = "force_update_required"; public static final String KEY_CURRENT_VERSION = "force_update_current_version"; public static final String KEY_UPDATE_URL = "force_update_store_url"; private final OnUpdateNeededListener onUpdateNeededListener; - private Context context; + private final Context context; public interface OnUpdateNeededListener { void onUpdateNeeded(String updateUrl); @@ -68,7 +67,7 @@ public static String getAppVersion(Context context) { public static class Builder { - private Context context; + private final Context context; private OnUpdateNeededListener onUpdateNeededListener; public Builder(Context context) { diff --git a/collect_app/src/main/java/org/odk/collect/android/dao/InstancesDao.java b/collect_app/src/main/java/org/odk/collect/android/dao/InstancesDao.java index c80461512..a046e4cd2 100644 --- a/collect_app/src/main/java/org/odk/collect/android/dao/InstancesDao.java +++ b/collect_app/src/main/java/org/odk/collect/android/dao/InstancesDao.java @@ -25,22 +25,11 @@ import org.odk.collect.android.application.Collect; import org.odk.collect.android.dto.Instance; import org.odk.collect.android.provider.InstanceProviderAPI; -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; import org.odk.collect.android.utilities.ApplicationConstants; import java.util.ArrayList; import java.util.List; -import io.reactivex.Observable; -import io.reactivex.functions.Function; -import timber.log.Timber; - -import static org.fieldsight.naxa.common.Constant.FormDeploymentFrom.PROJECT; -import static org.fieldsight.naxa.common.Constant.FormDeploymentFrom.SITE; - /** * This class is used to encapsulate all access to the {@link org.odk.collect.android.provider.InstanceProvider#DATABASE_NAME} * For more information about this pattern go to https://en.wikipedia.org/wiki/Data_access_object diff --git a/collect_app/src/main/java/org/odk/collect/android/fragments/DataManagerList.java b/collect_app/src/main/java/org/odk/collect/android/fragments/DataManagerList.java index 6c40acb77..4c07ee43b 100644 --- a/collect_app/src/main/java/org/odk/collect/android/fragments/DataManagerList.java +++ b/collect_app/src/main/java/org/odk/collect/android/fragments/DataManagerList.java @@ -29,14 +29,12 @@ import androidx.loader.content.CursorLoader; import org.fieldsight.collect.android.R; - +import org.odk.collect.android.adapters.InstanceListCursorAdapter; import org.odk.collect.android.application.Collect; +import org.odk.collect.android.dao.InstancesDao; import org.odk.collect.android.listeners.DeleteInstancesListener; import org.odk.collect.android.listeners.DiskSyncListener; import org.odk.collect.android.provider.InstanceProviderAPI.InstanceColumns; -import org.fieldsight.naxa.login.model.Site; -import org.odk.collect.android.adapters.InstanceListCursorAdapter; -import org.odk.collect.android.dao.InstancesDao; import org.odk.collect.android.tasks.DeleteInstancesTask; import org.odk.collect.android.tasks.InstanceSyncTask; import org.odk.collect.android.tasks.sms.contracts.SmsSubmissionManagerContract; @@ -46,8 +44,6 @@ import timber.log.Timber; -import static org.fieldsight.naxa.common.Constant.EXTRA_OBJECT; - /** * Responsible for displaying and deleting all the saved form instances * directory. diff --git a/collect_app/src/main/java/org/odk/collect/android/preferences/ServerPreferencesFragment.java b/collect_app/src/main/java/org/odk/collect/android/preferences/ServerPreferencesFragment.java index 9d95e2c30..5150a16fc 100644 --- a/collect_app/src/main/java/org/odk/collect/android/preferences/ServerPreferencesFragment.java +++ b/collect_app/src/main/java/org/odk/collect/android/preferences/ServerPreferencesFragment.java @@ -35,17 +35,15 @@ import androidx.appcompat.content.res.AppCompatResources; -import com.google.android.gms.analytics.HitBuilders; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import org.fieldsight.collect.android.R; import org.odk.collect.android.application.Collect; import org.odk.collect.android.http.CollectServerClient; +import org.odk.collect.android.injection.DaggerUtils; import org.odk.collect.android.listeners.OnBackPressedListener; import org.odk.collect.android.listeners.PermissionListener; -import org.odk.collect.android.injection.DaggerUtils; - import org.odk.collect.android.preferences.filters.ControlCharacterFilter; import org.odk.collect.android.preferences.filters.WhitespaceFilter; import org.odk.collect.android.utilities.FileUtils; diff --git a/collect_app/src/main/java/org/odk/collect/android/provider/FormsProvider.java b/collect_app/src/main/java/org/odk/collect/android/provider/FormsProvider.java index a31fc498a..af76080af 100644 --- a/collect_app/src/main/java/org/odk/collect/android/provider/FormsProvider.java +++ b/collect_app/src/main/java/org/odk/collect/android/provider/FormsProvider.java @@ -25,7 +25,6 @@ import android.net.Uri; import android.text.TextUtils; -import org.fieldsight.collect.android.R; import androidx.annotation.NonNull; import org.odk.collect.android.application.Collect; diff --git a/collect_app/src/main/java/org/odk/collect/android/tasks/DownloadFormsTask.java b/collect_app/src/main/java/org/odk/collect/android/tasks/DownloadFormsTask.java index 51e55caf1..d6b52b250 100644 --- a/collect_app/src/main/java/org/odk/collect/android/tasks/DownloadFormsTask.java +++ b/collect_app/src/main/java/org/odk/collect/android/tasks/DownloadFormsTask.java @@ -36,7 +36,7 @@ public class DownloadFormsTask extends AsyncTask, String, HashMap> implements FormDownloaderListener { private DownloadFormsTaskListener stateListener; - private boolean isTempDownload; + private final boolean isTempDownload; public DownloadFormsTask(boolean isTempDownload) { this.isTempDownload = isTempDownload; diff --git a/collect_app/src/main/java/org/odk/collect/android/tasks/InstanceGoogleSheetsUploaderTask.java b/collect_app/src/main/java/org/odk/collect/android/tasks/InstanceGoogleSheetsUploaderTask.java index 9fd86b96e..dffcfff52 100644 --- a/collect_app/src/main/java/org/odk/collect/android/tasks/InstanceGoogleSheetsUploaderTask.java +++ b/collect_app/src/main/java/org/odk/collect/android/tasks/InstanceGoogleSheetsUploaderTask.java @@ -16,8 +16,6 @@ import android.database.Cursor; -import com.google.android.gms.analytics.HitBuilders; - import org.fieldsight.collect.android.R; import org.odk.collect.android.application.Collect; import org.odk.collect.android.dao.FormsDao; diff --git a/collect_app/src/main/java/org/odk/collect/android/utilities/DateTimeUtils.java b/collect_app/src/main/java/org/odk/collect/android/utilities/DateTimeUtils.java index 4dcd30102..7dc1cc9c3 100644 --- a/collect_app/src/main/java/org/odk/collect/android/utilities/DateTimeUtils.java +++ b/collect_app/src/main/java/org/odk/collect/android/utilities/DateTimeUtils.java @@ -4,7 +4,6 @@ import android.os.Build; import android.text.format.DateUtils; - import org.fieldsight.collect.android.R; import org.joda.time.DateTime; import org.joda.time.DateTimeZone; @@ -12,7 +11,6 @@ import org.joda.time.chrono.CopticChronology; import org.joda.time.chrono.EthiopicChronology; import org.joda.time.chrono.IslamicChronology; - import org.joda.time.chrono.PersianChronologyKhayyamBorkowski; import org.odk.collect.android.logic.DatePickerDetails; diff --git a/collect_app/src/main/java/org/odk/collect/android/utilities/DownloadFormListUtils.java b/collect_app/src/main/java/org/odk/collect/android/utilities/DownloadFormListUtils.java index 92eb8e3b0..57a240b3e 100644 --- a/collect_app/src/main/java/org/odk/collect/android/utilities/DownloadFormListUtils.java +++ b/collect_app/src/main/java/org/odk/collect/android/utilities/DownloadFormListUtils.java @@ -27,7 +27,6 @@ import org.fieldsight.collect.android.R; import org.javarosa.xform.parse.XFormParser; import org.kxml2.kdom.Element; -import org.odk.collect.android.application.Collect; import org.odk.collect.android.dao.FormsDao; import org.odk.collect.android.http.CollectServerClient; import org.odk.collect.android.logic.FormDetails; diff --git a/collect_app/src/main/java/org/odk/collect/android/utilities/FormDownloader.java b/collect_app/src/main/java/org/odk/collect/android/utilities/FormDownloader.java index 45bf63b3d..ca5f8e106 100644 --- a/collect_app/src/main/java/org/odk/collect/android/utilities/FormDownloader.java +++ b/collect_app/src/main/java/org/odk/collect/android/utilities/FormDownloader.java @@ -54,7 +54,7 @@ public class FormDownloader { protected FormsDao formsDao; - private boolean isTempDownload; + private final boolean isTempDownload; @Inject CollectServerClient collectServerClient;