androidx.databinding.DataBindingUtil Java Examples

The following examples show how to use androidx.databinding.DataBindingUtil. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProgramAdapter.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {

    if (convertView == null) {
        LayoutInflater inflater = LayoutInflater.from(parent.getContext());
        SpinnerProgramLayoutBinding binding = DataBindingUtil.inflate(inflater, R.layout.spinner_program_layout, parent, false);
        convertView = binding.getRoot();
        if (position > 0)
            binding.setProgram(programs.get(position - 1));
        binding.setProgramTitle(String.format(getContext().getString(R.string.all_tei_type), trackedEntityName));
        binding.spinnerText.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20);
        binding.spinnerText.setTextColor(ContextCompat.getColor(binding.spinnerText.getContext(), R.color.white_faf));
    }
    return convertView;

}
 
Example #2
Source File: DataBindingExampleActivity.java    From html-textview with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    binding = DataBindingUtil.setContentView(this, R.layout.activity_data_binding_example);

    // create dummy item
    NewsItem item = new NewsItem();
    item.setHtml("<p>Interdum et malesuada <b>some bold text in here</b> fames ac ante ipsum primis in faucibus.</p>");

    // in XML we declared a variable newsItem, data binding generated the set method
    // once set, all fields/values/views are updated accordingly
    binding.setNewsItem(item);

    // if you have set an android:id in XML, data binding do the 'findViewById()'
    DrawTableLinkSpan drawTableLinkSpan = new DrawTableLinkSpan();
    drawTableLinkSpan.setTableLinkText("[tap for table]");
    binding.htmlText.setDrawTableLinkSpan(drawTableLinkSpan);
}
 
Example #3
Source File: LibraryActivity.java    From Jockey with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreateLayout(@Nullable Bundle savedInstanceState) {
    super.onCreateLayout(savedInstanceState);
    ViewGroup contentViewContainer = findViewById(android.R.id.content);
    View root = contentViewContainer.getChildAt(0);
    contentViewContainer.removeAllViews();

    mBinding = DataBindingUtil.setContentView(this, R.layout.activity_library);
    ViewGroup contentContainer = findViewById(R.id.library_content_container);
    contentContainer.addView(root);

    mBinding.libraryDrawerNavigationView.setNavigationItemSelectedListener(item -> {
        mBinding.libraryDrawerLayout.closeDrawers();
        onNavigationItemSelected(item.getItemId());
        return true;
    });
}
 
Example #4
Source File: CustomDialog.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void show() {
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    LayoutInflater inflater = LayoutInflater.from(context);
    CustomDialogBinding binding = DataBindingUtil.inflate(inflater, R.layout.custom_dialog, null, false);

    binding.setTitle(title);
    binding.setMessage(message);
    binding.setNegativeText(negativeText);
    binding.setPositiveText(positiveText);

    builder.setView(binding.getRoot());

    dialog = builder.create();
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);

    if (!TextUtils.isEmpty(negativeText))
        binding.negative.setOnClickListener(this);
    if (!TextUtils.isEmpty(positiveText))
        binding.possitive.setOnClickListener(this);
    dialog.show();
}
 
Example #5
Source File: ContactOverviewSelectionAdapter.java    From natrium-android-wallet with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
public ContactOverviewSelectionAdapter.ViewHolder onCreateViewHolder(ViewGroup parent,
                                                                     int viewType) {
    ViewHolderContactBinding binding = DataBindingUtil.inflate(
            LayoutInflater.from(parent.getContext()),
            R.layout.view_holder_contact, parent, false);

    ViewHolder viewHolder = new ViewHolder(binding);
    View view = binding.getRoot();
    view.setOnClickListener((View v) -> {
        Contact c = (Contact) view.getTag();
        if (c != null) {
            RxBus.get().post(new ContactSelected(c.getName(), c.getAddress()));
        }
    });

    return viewHolder;
}
 
Example #6
Source File: ImageRow.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public ImageHolder onCreate(@NonNull ViewGroup parent, int count, ObservableField<String> imageSelector, String sectionRendering) {

        FormImageBinding binding = DataBindingUtil.inflate(inflater, R.layout.form_image, parent, false);

        Integer height = null;
        Integer parentHeight = parent.getHeight();
        if (sectionRendering != null && sectionRendering.equals(ProgramStageSectionRenderingType.SEQUENTIAL.name())) {
            height = parentHeight / (count > 2 ? 3 : count);
        } else if (sectionRendering != null && sectionRendering.equals(ProgramStageSectionRenderingType.MATRIX.name())) {
            height = parentHeight / (count / 2 + 1);
        }

        View rootView = binding.getRoot();
        if (height != null) {
            ViewGroup.LayoutParams layoutParams = rootView.getLayoutParams();
            layoutParams.height = height;
            rootView.setLayoutParams(layoutParams);
        }

        return new ImageHolder(binding, processor, imageSelector);
    }
 
Example #7
Source File: AccountHistoryAdapter.java    From natrium-android-wallet with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
public AccountHistoryAdapter.ViewHolder onCreateViewHolder(ViewGroup parent,
                                                           int viewType) {
    ViewHolderTransactionBinding binding = DataBindingUtil.inflate(
            LayoutInflater.from(parent.getContext()),
            R.layout.view_holder_transaction, parent, false);

    ViewHolder viewHolder = new ViewHolder(binding);
    View view = binding.getRoot();
    view.setOnClickListener((View v) -> {
        AccountHistoryResponseItem h = (AccountHistoryResponseItem) view.getTag();
        if (h != null) {
            RxBus.get().post(new TransactionItemClicked(h.getHash(), h.getAccount()));
        }
    });

    return viewHolder;
}
 
Example #8
Source File: MediaBrowserActivity.java    From Pix-Art-Messenger with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (savedInstanceState != null) {
        this.mSavedInstanceAccount = savedInstanceState.getString("account");
        this.mSavedInstanceJid = savedInstanceState.getString("jid");
    }
    this.binding = DataBindingUtil.setContentView(this, R.layout.activity_media_browser);
    setSupportActionBar((Toolbar) binding.toolbar);
    configureActionBar(getSupportActionBar());
    mMediaAdapter = new MediaAdapter(this, R.dimen.media_size);
    this.binding.media.setAdapter(mMediaAdapter);
    GridManager.setupLayoutManager(this, this.binding.media, R.dimen.browser_media_size);
    this.binding.noMedia.setVisibility(View.GONE);
    this.binding.progressbar.setVisibility(View.VISIBLE);
    this.OnlyImagesVideos = getPreferences().getBoolean("show_videos_images_only", this.getResources().getBoolean(R.bool.show_videos_images_only));
}
 
Example #9
Source File: ImageRow.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public ImageHolder onCreate(@NonNull ViewGroup parent, int count, FlowableProcessor<String> imageSelector) {
    FormImageBinding binding = DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), R.layout.form_image, parent, false);
    Integer height = null;
    if (renderType.equals(ProgramStageSectionRenderingType.SEQUENTIAL.name())) {
        height = parent.getMeasuredHeight() / (count > 2 ? 3 : count);
    } else if (renderType.equals(ProgramStageSectionRenderingType.MATRIX.name())) {
        height = parent.getMeasuredHeight() / (count > 2 ? 2 : count);
    }

    View rootView = binding.getRoot();
    if (height != null) {
        ViewGroup.LayoutParams layoutParams = rootView.getLayoutParams();
        layoutParams.height = height;
        rootView.setLayoutParams(layoutParams);
    }

    return new ImageHolder(binding, processor, isBackgroundTransparent, renderType, rootView, imageSelector);
}
 
Example #10
Source File: MyCoursesListFragment.java    From edx-app-android with Apache License 2.0 6 votes vote down vote up
private void addFindCoursesFooter() {
    // Validate footer is not already added.
    if (binding.myCourseList.getFooterViewsCount() > 0) {
        return;
    }
    if (ConfigUtil.Companion.isCourseDiscoveryEnabled(environment)) {
        // Add 'Find a Course' list item as a footer.
        final PanelFindCourseBinding footer = DataBindingUtil.inflate(LayoutInflater.from(getActivity()),
                R.layout.panel_find_course, binding.myCourseList, false);
        binding.myCourseList.addFooterView(footer.getRoot(), null, false);
        footer.courseBtn.setOnClickListener(v -> {
            environment.getAnalyticsRegistry().trackUserFindsCourses();
            EventBus.getDefault().post(new MoveToDiscoveryTabEvent(Screen.COURSE_DISCOVERY));
        });
    }
    // Add empty view to cause divider to render at the bottom of the list.
    binding.myCourseList.addFooterView(new View(getContext()), null, false);
}
 
Example #11
Source File: ReviewFragment.java    From android-popular-movies-app with Apache License 2.0 6 votes vote down vote up
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Instantiate mReviewBinding using DataBindingUtil
    mReviewBinding = DataBindingUtil.inflate(
            inflater, R.layout.fragment_review, container, false);
    View rootView = mReviewBinding.getRoot();

    // A LinearLayoutManager is responsible for measuring and positioning item views within a
    // RecyclerView into a linear list.
    LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
    mReviewBinding.rvReview.setLayoutManager(layoutManager);
    mReviewBinding.rvReview.setHasFixedSize(true);

    // Create an empty ArrayList
    mReviews = new ArrayList<>();

    // The ReviewAdapter is responsible for displaying each item in the list.
    mReviewAdapter = new ReviewAdapter(mReviews, this);
    // Set ReviewAdapter on RecyclerView
    mReviewBinding.rvReview.setAdapter(mReviewAdapter);

    // Show a message when offline
    showOfflineMessage(isOnline());

    return rootView;
}
 
Example #12
Source File: BaseFragment.java    From Pixiv-Shaft with MIT License 6 votes vote down vote up
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater,
                         @Nullable ViewGroup container,
                         @Nullable Bundle savedInstanceState) {
    if (parentView == null) {
        initLayout();
        baseBind = DataBindingUtil.inflate(inflater, mLayoutID, container, false);
        if (baseBind != null) {
            parentView = baseBind.getRoot();
        } else {
            parentView = inflater.inflate(mLayoutID, container, false);
        }
        initView(parentView);
        initData();
    } else {
        ViewGroup viewGroup = (ViewGroup) parentView.getParent();
        if (viewGroup != null) {
            viewGroup.removeView(parentView);
        }
    }
    return parentView;
}
 
Example #13
Source File: SitePermissionAdapter.java    From FirefoxReality with Mozilla Public License 2.0 6 votes vote down vote up
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
    SitePermissionItemBinding binding = DataBindingUtil
            .inflate(LayoutInflater.from(parent.getContext()), R.layout.site_permission_item,
                    parent, false);
    binding.setCallback(mCallback);
    binding.layout.setOnHoverListener((v, event) -> {
        int ev = event.getActionMasked();
        switch (ev) {
            case MotionEvent.ACTION_HOVER_ENTER:
                binding.delete.setHovered(true);
                return false;

            case MotionEvent.ACTION_HOVER_EXIT:
                if (!ViewUtils.isInsideView(binding.delete, (int)event.getRawX(), (int)event.getRawY())) {
                    binding.delete.setHovered(false);
                }
                return false;
        }

        return false;
    });
    binding.delete.setOnHoverListener(mIconHoverListener);

    return new PermissionSiteViewHolder(binding);
}
 
Example #14
Source File: PromptDialogWidget.java    From FirefoxReality with Mozilla Public License 2.0 6 votes vote down vote up
public void updateUI() {
    removeAllViews();

    LayoutInflater inflater = LayoutInflater.from(getContext());

    // Inflate this data binding layout
    mBinding = DataBindingUtil.inflate(inflater, R.layout.prompt_dialog, this, true);

    mBinding.leftButton.setOnClickListener(v ->  {
        if (mAppDialogDelegate != null) {
            mAppDialogDelegate.onButtonClicked(NEGATIVE, isChecked());
        }
    });
    mBinding.rightButton.setOnClickListener(v -> {
        if (mAppDialogDelegate != null) {
            mAppDialogDelegate.onButtonClicked(POSITIVE, isChecked());
        }
    });
}
 
Example #15
Source File: BaseActivity.java    From shinny-futures-android with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mViewDataBinding = DataBindingUtil.setContentView(this, mLayoutID);
    mToolbar = findViewById(R.id.toolbar);
    mToolbarTitle = findViewById(R.id.title_toolbar);
    mToolbar.setTitle("");
    mToolbarTitle.setText(mTitle);
    setSupportActionBar(mToolbar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setHomeButtonEnabled(true);
    }
    sContext = BaseApplication.getContext();
    sDataManager = DataManager.getInstance();
    initData();
    initEvent();
    updateToolbarFromNetwork(sContext, mTitle);
    boolean isFirm = (boolean) SPUtils.get(sContext, CONFIG_IS_FIRM, true);
    changeStatusBarColor(isFirm);
}
 
Example #16
Source File: ErrorDialog.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
    ErrorDialogBinding binding = DataBindingUtil.inflate(inflater, R.layout.error_dialog, container, false);

    binding.titleDialog.setText(title);
    ErrorAdapter errorAdapter = new ErrorAdapter(data, sharing);
    binding.errorRecycler.setAdapter(errorAdapter);
    binding.errorRecycler.addItemDecoration(divider);
    binding.possitive.setOnClickListener(view -> {
        if (sharing.get()) {
            Intent sendIntent = new Intent();
            sendIntent.setAction(Intent.ACTION_SEND);
            sendIntent.putExtra(Intent.EXTRA_TEXT, new Gson().toJson(data));
            sendIntent.putExtra(Intent.EXTRA_SUBJECT, shareMessageTitle);
            sendIntent.setType("text/plain");
            startActivity((Intent.createChooser(sendIntent, shareTitle)));
        } else
            dismiss();
    });
    binding.setSharing(sharing);
    binding.setShareList(shareData);
    binding.shareButton.setOnClickListener(view -> sharing.set(!sharing.get()));
    subscribeToErrors(errorAdapter.asFlowable());
    return binding.getRoot();
}
 
Example #17
Source File: SetupActivity.java    From GDPRDialog with Apache License 2.0 6 votes vote down vote up
private void initViews() {
    mBinding = DataBindingUtil.setContentView(this, R.layout.activity_setup);

    mBinding.cbAllowNonPersonalisedForPaidVersions.setEnabled(mBinding.cbHasPaidVersion.isChecked());
    mBinding.cbHasPaidVersion.setOnCheckedChangeListener((buttonView, isChecked) -> mBinding.cbAllowNonPersonalisedForPaidVersions.setEnabled(isChecked));
    mBinding.cbShowAsActivity.setOnCheckedChangeListener((buttonView, isChecked) -> {
        App.USE_ACTIVITY = isChecked;
        mBinding.cbBottomSheet.setEnabled(!isChecked);
    });
    mBinding.cbCheckRequestLocation.setOnCheckedChangeListener((buttonView, isChecked) -> {
        mBinding.cbCheckRequestLocationFallbackTelephonyManager.setEnabled(isChecked);
        mBinding.cbCheckRequestLocationFallbackTimeZone.setEnabled(isChecked);
    });

    mBinding.cbShowAsActivity.setChecked(App.USE_ACTIVITY);
    mBinding.cbBottomSheet.setEnabled(!App.USE_ACTIVITY);

    ViewPagerAdapter adapter = new ViewPagerAdapter();
    mBinding.viewpager.setAdapter(adapter);
    mBinding.tabs.setupWithViewPager(mBinding.viewpager);
}
 
Example #18
Source File: DownloadsAdapter.java    From FirefoxReality with Mozilla Public License 2.0 5 votes vote down vote up
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
    DownloadItemBinding binding = DataBindingUtil
            .inflate(LayoutInflater.from(parent.getContext()), R.layout.download_item,
                    parent, false);
    binding.setCallback(mDownloadItemCallback);
    binding.setIsHovered(false);
    binding.setIsNarrow(mIsNarrowLayout);

    return new DownloadItemViewHolder(binding);
}
 
Example #19
Source File: RateUsDialog.java    From android-mvvm-architecture with Apache License 2.0 5 votes vote down vote up
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    DialogRateUsBinding binding = DataBindingUtil.inflate(inflater, R.layout.dialog_rate_us, container, false);
    View view = binding.getRoot();

    AndroidSupportInjection.inject(this);
    mRateUsViewModel = ViewModelProviders.of(this,factory).get(RateUsViewModel.class);
    binding.setViewModel(mRateUsViewModel);

    mRateUsViewModel.setNavigator(this);

    return view;
}
 
Example #20
Source File: BrokerAdapter.java    From shinny-futures-android with GNU General Public License v3.0 5 votes vote down vote up
@Override
public ItemViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    ItemActivityBrokerBinding binding = DataBindingUtil.inflate(LayoutInflater
            .from(sContext), R.layout.item_activity_broker, parent, false);
    ItemViewHolder holder = new ItemViewHolder(binding.getRoot());
    holder.setBinding(binding);
    return holder;
}
 
Example #21
Source File: PeriodDialog.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
    binding = DataBindingUtil.inflate(inflater, R.layout.dialog_period, container, false);

    binding.title.setText(title);
    binding.acceptButton.setOnClickListener(view -> {

        possitiveListener.onDateSet(currentDate);
        dismiss();
    });
    binding.clearButton.setOnClickListener(view -> dismiss());

    binding.periodSubtitle.setText(period.name());
    if (minDate == null || currentDate.after(minDate))
        currentDate = DateUtils.getInstance().getNextPeriod(period, currentDate, 0);
    else if (minDate != null && currentDate.before(minDate))
        currentDate = DateUtils.getInstance().getNextPeriod(period, minDate, 0);
    else
        currentDate = DateUtils.getInstance().getNextPeriod(period, currentDate, 0);

    binding.selectedPeriod.setText(DateUtils.getInstance().getPeriodUIString(period, currentDate, Locale.getDefault()));
    checkConstraintDates();

    binding.periodBefore.setOnClickListener(view -> {
        previousPeriod();
        checkConstraintDates();

    });
    binding.periodNext.setOnClickListener(view -> {
        nextPeriod();
        checkConstraintDates();
    });

    return binding.getRoot();
}
 
Example #22
Source File: KlineDurationAdapter.java    From shinny-futures-android with GNU General Public License v3.0 5 votes vote down vote up
@Override
public ItemViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    ItemKlineDurationBinding binding = DataBindingUtil.inflate(LayoutInflater
            .from(sContext), R.layout.item_kline_duration, parent, false);
    ItemViewHolder holder = new ItemViewHolder(binding.getRoot());
    holder.setBinding(binding);
    return holder;
}
 
Example #23
Source File: ViewModelHelper.java    From AndroidViewModel with Apache License 2.0 5 votes vote down vote up
public void performBinding(@NonNull final IView bindingView) {
    // skip if already create
    if (mBinding != null) {
        return;
    }

    // get ViewModelBinding config
    final ViewModelBindingConfig viewModelConfig = bindingView.getViewModelBindingConfig();
    // if fragment not providing ViewModelBindingConfig, do not perform binding operations
    if (viewModelConfig == null) {
        return;
    }

    // perform Data Binding initialization
    final ViewDataBinding viewDataBinding;
    if (bindingView instanceof Activity) {
        viewDataBinding = DataBindingUtil.setContentView(((Activity) bindingView), viewModelConfig.getLayoutResource());
    } else if (bindingView instanceof Fragment) {
        viewDataBinding = DataBindingUtil.inflate(LayoutInflater.from(viewModelConfig.getContext()), viewModelConfig.getLayoutResource(), null, false);
    } else {
        throw new IllegalArgumentException("View must be an instance of Activity or Fragment (support-v4).");
    }

    // bind all together
    if (!viewDataBinding.setVariable(viewModelConfig.getViewModelVariableName(), getViewModel())) {
        throw new IllegalArgumentException("Binding variable wasn't set successfully. Probably viewModelVariableName of your " +
                "ViewModelBindingConfig of " + bindingView.getClass().getSimpleName() + " doesn't match any variable in "
                + viewDataBinding.getClass().getSimpleName());
    }

    mBinding = viewDataBinding;
}
 
Example #24
Source File: SettingsActivity.java    From earth with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    final SettingsActivityBinding binding = DataBindingUtil.setContentView(
            this, R.layout.settings_activity);

    binding.toolbar.setNavigationOnClickListener(v -> supportFinishAfterTransition());

    getSupportFragmentManager().beginTransaction()
            .replace(R.id.container, new SettingsFragment())
            .commit();
}
 
Example #25
Source File: FileCellRow.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@NonNull
@Override
public FileHolder onCreate(@NonNull ViewGroup parent) {
    binding = DataBindingUtil.inflate(inflater, R.layout.form_button_cell, parent, false);
    binding.formButton.setTextColor(ContextCompat.getColor(parent.getContext(), R.color.colorPrimary));
    binding.setTableScale(tableScale);
    return new FileHolder(binding);
}
 
Example #26
Source File: TableFieldDialog.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void show() {
    Builder builder = new Builder(context);
    LayoutInflater inflater = LayoutInflater.from(context);
    TableFieldDialogBinding binding = DataBindingUtil.inflate(inflater, R.layout.table_field_dialog, null, false);

    binding.setTitle(title);
    binding.setSubTitle(subTitle);
    binding.setNegativeText(context.getString(R.string.cancel));
    binding.setPositiveText(context.getString(R.string.action_accept));

    binding.viewLayout.addView(view);
    builder.setView(binding.getRoot());

    dialog = builder.create();
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);

    if (listener != null) {
        binding.negative.setOnClickListener(this);
        binding.possitive.setOnClickListener(this);
    }

    if(clearListener != null) {
        binding.clearSelection.setOnClickListener(this);
    }
    else{
        binding.clearSelection.setVisibility(View.GONE);
    }

    dialog.show();
}
 
Example #27
Source File: SimpleBlurPlaygroundFragment.java    From Dali with Apache License 2.0 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    FragmentSimpleBlurBinding binding = DataBindingUtil.inflate(inflater, R.layout.fragment_simple_blur, container, false);

    Dali dali = Dali.create(getActivity());

    float[] data = new float[]{
            255, 0, 0, 0,
            0, 255, 0, 0,
            0, 0, 255, 0,
            0, 0, 0, 255
    };

    final ImageView iv = binding.image;
    BlurBuilder.JobDescription jobDescription1 = dali.load(R.drawable.test_img1).placeholder(R.drawable.test_img1).blurRadius(12).algorithm(EBlurAlgorithm.NONE)
            .addPreProcessor(new RenderScriptColorFilter(dali.getContextWrapper().getRenderScript(), data)).concurrent().into(iv);
    binding.subtitle1.setText(jobDescription1.builderDescription);

    final ImageView iv2 = binding.image2;
    BlurBuilder.JobDescription jobDescription2 = dali.load(R.drawable.test_img1).placeholder(R.drawable.test_img1).blurRadius(12).brightness(0).concurrent().into(iv2);
    binding.subtitle2.setText(jobDescription2.builderDescription);

    final ImageView iv3 = binding.image3;
    BlurBuilder.JobDescription jobDescription3 = dali.load(R.drawable.test_img1).placeholder(R.drawable.test_img1).blurRadius(12).downScale(1).colorFilter(Color.parseColor("#ffccdceb")).concurrent().reScale().into(iv3);
    binding.subtitle3.setText(jobDescription3.builderDescription);

    final ImageView iv4 = binding.image4;
    BlurBuilder.JobDescription jobDescription4 = dali.load(R.drawable.test_img1).placeholder(R.drawable.test_img1).blurRadius(8).downScale(4).brightness(-40).concurrent().reScale().into(iv4);
    binding.subtitle4.setText(jobDescription4.builderDescription);

    return binding.getRoot();
}
 
Example #28
Source File: CategoryDetailActivity.java    From CloudReader with Apache License 2.0 5 votes vote down vote up
@Override
    protected void onCreate(Bundle savedInstanceState) {
//        ToolbarHelper.initTranslucent(this);
        StatusBarUtil.setTranslucentStatus(this);
        super.onCreate(savedInstanceState);
        bindingView = DataBindingUtil.setContentView(this, R.layout.activity_category_detail);
        ToolbarHelper.initFullBar(bindingView.toolbar, this);
        bindingView.toolbar.setNavigationOnClickListener(v -> finish());

        initData();
    }
 
Example #29
Source File: RelationshipLiveAdapter.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@NonNull
@Override
public SearchRelationshipViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
    LayoutInflater inflater = LayoutInflater.from(parent.getContext());
    ItemSearchRelationshipTrackedEntityBinding binding = DataBindingUtil.inflate(inflater, R.layout.item_search_relationship_tracked_entity, parent, false);
    return new SearchRelationshipViewHolder(binding);
}
 
Example #30
Source File: RadioButtonRow.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@NonNull
@Override
public RadioButtonHolder onCreate(@NonNull ViewGroup parent) {
    FormYesNoBinding binding = DataBindingUtil.inflate(inflater,
            R.layout.form_yes_no, parent, false);
    binding.customYesNo.setIsBgTransparent(isBgTransparent);
    return new RadioButtonHolder(binding, processor, isSearchMode,currentSelection);
}