use of android.databinding.BindingAdapter in project android-mvvm-architecture by MindorksOpenSource.
the class BindingUtils method addQuestionItems.
@BindingAdapter({ "adapter", "action" })
public static void addQuestionItems(SwipePlaceHolderView mCardsContainerView, List<QuestionCardData> mQuestionList, int mAction) {
if (mAction == MainViewModel.ACTION_ADD_ALL) {
if (mQuestionList != null) {
mCardsContainerView.removeAllViews();
for (QuestionCardData question : mQuestionList) {
if (question != null && question.options != null && question.options.size() == 3) {
mCardsContainerView.addView(new QuestionCard(question));
}
}
ViewAnimationUtils.scaleAnimateView(mCardsContainerView);
}
}
}
use of android.databinding.BindingAdapter in project android-mvvm-architecture by MindorksOpenSource.
the class BindingUtils method addOpenSourceItems.
@BindingAdapter({ "adapter" })
public static void addOpenSourceItems(RecyclerView recyclerView, List<OpenSourceItemViewModel> openSourceItems) {
OpenSourceAdapter adapter = (OpenSourceAdapter) recyclerView.getAdapter();
if (adapter != null) {
adapter.clearItems();
adapter.addItems(openSourceItems);
}
}
use of android.databinding.BindingAdapter in project android-mvvm-architecture by MindorksOpenSource.
the class BindingUtils method addBlogItems.
@BindingAdapter({ "adapter" })
public static void addBlogItems(RecyclerView recyclerView, List<BlogResponse.Blog> blogs) {
BlogAdapter adapter = (BlogAdapter) recyclerView.getAdapter();
if (adapter != null) {
adapter.clearItems();
adapter.addItems(blogs);
}
}
use of android.databinding.BindingAdapter in project cw-omnibus by commonsguy.
the class RequestFocusActivity method bindRequestFocus.
@BindingAdapter("app:requestFocus")
public static void bindRequestFocus(View v, String focusMode) {
Configuration cfg = v.getResources().getConfiguration();
boolean hasNoKeyboard = cfg.keyboard == Configuration.KEYBOARD_NOKEYS;
boolean keyboardHidden = cfg.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_YES;
boolean result = false;
if (TRUE.equals(focusMode)) {
result = true;
} else if (IF_HARD_KEYBOARD.equals(focusMode)) {
if (!hasNoKeyboard && !keyboardHidden) {
result = true;
}
} else if (IF_NO_HARD_KEYBOARD.equals(focusMode)) {
if (hasNoKeyboard || keyboardHidden) {
result = true;
if (hasNoKeyboard)
v.setFocusableInTouchMode(true);
}
} else {
throw new IllegalArgumentException("Unexpected focusMode value: " + focusMode);
}
if (result) {
v.setFocusable(true);
v.requestFocus();
}
}
use of android.databinding.BindingAdapter in project T-MVP by north2016.
the class BindingUtils method loadRoundImg.
@BindingAdapter({ "roundImageUrl" })
public static void loadRoundImg(ImageView v, String url) {
v.setColorFilter(v.getContext().getResources().getColor(SpUtil.isNight() ? R.color.CoverColor : R.color.colorWhite), PorterDuff.Mode.MULTIPLY);
Glide.with(v.getContext()).load(getFuckUrl(url)).diskCacheStrategy(DiskCacheStrategy.ALL).transform(new GlideCircleTransform(v.getContext())).error(R.mipmap.ic_launcher).into(v);
}
Aggregations