use of org.odk.collect.android.utilities.ThemeUtils in project collect by opendatakit.
the class GoogleMapFragment method updateLocationIndicator.
private void updateLocationIndicator(LatLng loc, double radius) {
if (map == null) {
return;
}
if (locationCrosshairs == null) {
locationCrosshairs = map.addMarker(new MarkerOptions().position(loc).icon(getBitmapDescriptor(R.drawable.ic_crosshairs)).anchor(0.5f, // center the crosshairs on the position
0.5f));
}
if (accuracyCircle == null) {
int stroke = new ThemeUtils(requireContext()).getColorPrimaryDark();
int fill = getResources().getColor(R.color.color_primary_low_emphasis);
accuracyCircle = map.addCircle(new CircleOptions().center(loc).radius(radius).strokeWidth(1).strokeColor(stroke).fillColor(fill));
}
locationCrosshairs.setPosition(loc);
accuracyCircle.setCenter(loc);
accuracyCircle.setRadius(radius);
}
use of org.odk.collect.android.utilities.ThemeUtils in project collect by opendatakit.
the class GoogleAccountsManager method initCredential.
private void initCredential(@NonNull Context context) {
this.context = context;
intentChooseAccount = accountPicker.newChooseAccountIntent();
themeUtils = new ThemeUtils(context);
}
use of org.odk.collect.android.utilities.ThemeUtils in project collect by opendatakit.
the class ChoicesRecyclerView method enableDivider.
private void enableDivider() {
DividerItemDecoration divider = new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL);
Drawable drawable = ContextCompat.getDrawable(getContext(), R.drawable.inset_divider_64dp);
if (android.os.Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP_MR1) {
DrawableCompat.setTint(DrawableCompat.wrap(drawable), new ThemeUtils(getContext()).getColorOnSurface());
}
divider.setDrawable(drawable);
addItemDecoration(divider);
}
use of org.odk.collect.android.utilities.ThemeUtils in project collect by opendatakit.
the class ODKView method getDividerView.
private View getDividerView() {
View divider = new View(getContext());
divider.setBackgroundResource(new ThemeUtils(getContext()).getDivider());
divider.setMinimumHeight(3);
return divider;
}
use of org.odk.collect.android.utilities.ThemeUtils in project collect by opendatakit.
the class ODKView method highlightWidget.
/**
* Highlights the question at the given {@link FormIndex} in red for 2.5 seconds, scrolls the
* view to display that question at the top and gives it focus.
*/
public void highlightWidget(FormIndex formIndex) {
QuestionWidget qw = getQuestionWidget(formIndex);
if (qw != null) {
// postDelayed is needed because otherwise scrolling may not work as expected in case when
// answers are validated during form finalization.
new Handler().postDelayed(() -> {
qw.setFocus(getContext());
scrollTo(qw);
ValueAnimator va = new ValueAnimator();
va.setIntValues(new ThemeUtils(getContext()).getColorError(), getDrawingCacheBackgroundColor());
va.setEvaluator(new ArgbEvaluator());
va.addUpdateListener(valueAnimator -> qw.setBackgroundColor((int) valueAnimator.getAnimatedValue()));
va.setDuration(2500);
va.start();
}, 100);
}
}
Aggregations