forked from dhis2/dhis2-android-capture-app
-
Notifications
You must be signed in to change notification settings - Fork 4
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 #23 from EyeSeeTea/feature/bring_from_widp_add_fil…
…ter_by_text_value Feature/bring from widp add filter by text value
- Loading branch information
Showing
19 changed files
with
435 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"buildTime":"2020-07-17 17:34","gitSha":"46259d5e6"} | ||
{"buildTime":"2020-07-17 17:34","gitSha":"46259d5e6"} |
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
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
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
61 changes: 61 additions & 0 deletions
61
app/src/main/java/org/dhis2/utils/DataElementsAdapter.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,61 @@ | ||
package org.dhis2.utils; | ||
|
||
import android.content.Context; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.ArrayAdapter; | ||
|
||
import org.dhis2.databinding.SpinnerDataelementLayoutBinding; | ||
import org.hisp.dhis.android.core.dataelement.DataElement; | ||
|
||
import java.util.List; | ||
|
||
import androidx.annotation.ColorRes; | ||
import androidx.annotation.NonNull; | ||
import androidx.annotation.Nullable; | ||
import androidx.core.content.ContextCompat; | ||
|
||
public class DataElementsAdapter extends ArrayAdapter<DataElement> { | ||
|
||
private final List<DataElement> dataElements; | ||
private @ColorRes | ||
int textColor; | ||
|
||
public DataElementsAdapter(@NonNull Context context, int resource, int textViewResourceId, | ||
@NonNull List<DataElement> objects, @ColorRes int textColor) { | ||
super(context, resource, textViewResourceId, objects); | ||
this.dataElements = objects; | ||
this.textColor = textColor; | ||
} | ||
|
||
@NonNull | ||
@Override | ||
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) { | ||
|
||
LayoutInflater inflater = LayoutInflater.from(parent.getContext()); | ||
SpinnerDataelementLayoutBinding binding = SpinnerDataelementLayoutBinding.inflate(inflater, | ||
parent, false); | ||
binding.setDataElement(dataElements.get(position)); | ||
binding.spinnerText.setTextColor( | ||
ContextCompat.getColor(binding.spinnerText.getContext(), textColor)); | ||
return binding.getRoot(); | ||
|
||
} | ||
|
||
@Override | ||
public View getDropDownView(int position, @Nullable View convertView, | ||
@NonNull ViewGroup parent) { | ||
LayoutInflater inflater = LayoutInflater.from(parent.getContext()); | ||
SpinnerDataelementLayoutBinding binding = SpinnerDataelementLayoutBinding.inflate(inflater, | ||
parent, false); | ||
binding.setDataElement(dataElements.get(position)); | ||
|
||
return binding.getRoot(); | ||
} | ||
|
||
@Override | ||
public int getCount() { | ||
return super.getCount(); | ||
} | ||
} |
Oops, something went wrong.