Search in sources :

Example 6 with BindingAdapter

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);
        }
    }
}
Also used : QuestionCard(com.mindorks.framework.mvvm.ui.main.QuestionCard) QuestionCardData(com.mindorks.framework.mvvm.data.model.others.QuestionCardData) BindingAdapter(android.databinding.BindingAdapter)

Example 7 with BindingAdapter

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);
    }
}
Also used : OpenSourceAdapter(com.mindorks.framework.mvvm.ui.feed.opensource.OpenSourceAdapter) BindingAdapter(android.databinding.BindingAdapter)

Example 8 with BindingAdapter

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);
    }
}
Also used : BlogAdapter(com.mindorks.framework.mvvm.ui.feed.blogs.BlogAdapter) BindingAdapter(android.databinding.BindingAdapter)

Example 9 with BindingAdapter

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();
    }
}
Also used : Configuration(android.content.res.Configuration) BindingAdapter(android.databinding.BindingAdapter)

Example 10 with BindingAdapter

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);
}
Also used : GlideCircleTransform(com.base.util.helper.GlideCircleTransform) BindingAdapter(android.databinding.BindingAdapter)

Aggregations

BindingAdapter (android.databinding.BindingAdapter)15 Animator (android.animation.Animator)2 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)2 ObjectAnimator (android.animation.ObjectAnimator)2 AlertDialog (android.app.AlertDialog)2 DatePickerDialog (android.app.DatePickerDialog)2 TimePickerDialog (android.app.TimePickerDialog)2 Context (android.content.Context)2 ObservableField (android.databinding.ObservableField)2 Bitmap (android.graphics.Bitmap)2 Uri (android.net.Uri)2 Button (android.widget.Button)2 Function (org.fossasia.openevent.app.common.Function)2 DateUtils (org.fossasia.openevent.app.utils.DateUtils)2 LocalDate (org.threeten.bp.LocalDate)2 LocalDateTime (org.threeten.bp.LocalDateTime)2 LocalTime (org.threeten.bp.LocalTime)2 ZonedDateTime (org.threeten.bp.ZonedDateTime)2 DateTimeParseException (org.threeten.bp.format.DateTimeParseException)2 MediaWrapper (org.videolan.medialibrary.media.MediaWrapper)2