-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #119 from opensrp/fix-offline-maps-for-regions
Fix offline maps for regions
- Loading branch information
Showing
14 changed files
with
830 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
...rp-eusm/src/main/java/org/smartregister/eusm/adapter/EUSMDownloadedOfflineMapAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package org.smartregister.eusm.adapter; | ||
|
||
import android.content.Context; | ||
import android.view.View; | ||
|
||
import androidx.annotation.NonNull; | ||
|
||
import org.smartregister.tasking.adapter.DownloadedOfflineMapAdapter; | ||
import org.smartregister.tasking.model.OfflineMapModel; | ||
import org.smartregister.tasking.viewholder.DownloadedOfflineMapViewHolder; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class EUSMDownloadedOfflineMapAdapter extends DownloadedOfflineMapAdapter { | ||
|
||
private List<OfflineMapModel> offlineMapModels = new ArrayList<>(); | ||
|
||
public EUSMDownloadedOfflineMapAdapter(Context context, View.OnClickListener offlineMapClickHandler) { | ||
super(context, offlineMapClickHandler); | ||
} | ||
|
||
@Override | ||
public void setOfflineMapModels(List<OfflineMapModel> offlineMapModels) { | ||
this.offlineMapModels = offlineMapModels; | ||
super.setOfflineMapModels(offlineMapModels); | ||
} | ||
|
||
@Override | ||
public void onBindViewHolder(@NonNull DownloadedOfflineMapViewHolder viewHolder, int position) { | ||
super.onBindViewHolder(viewHolder, position); | ||
OfflineMapModel offlineMapModel = offlineMapModels.get(position); | ||
|
||
switch (offlineMapModel.getOfflineMapStatus()) { | ||
case READY: | ||
case DOWNLOADED: | ||
viewHolder.checkCheckBox(false); | ||
viewHolder.enableCheckBox(true); | ||
break; | ||
case SELECTED_FOR_DOWNLOAD: | ||
viewHolder.checkCheckBox(true); | ||
break; | ||
case DOWNLOAD_STARTED: | ||
viewHolder.checkCheckBox(true); | ||
viewHolder.enableCheckBox(false); | ||
break; | ||
default: | ||
break; | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.