Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataBinding support #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions tutoshowcase/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ android {
versionCode 1
versionName "1.0"
}

dataBinding {
enabled = true
}

buildTypes {
release {
minifyEnabled false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.databinding.DataBindingComponent;
import android.databinding.DataBindingUtil;
import android.databinding.ViewDataBinding;
import android.graphics.Rect;
import android.support.annotation.ColorInt;
import android.support.annotation.IdRes;
Expand Down Expand Up @@ -96,6 +99,12 @@ public TutoShowcase setContentView(@LayoutRes int content) {
return this;
}

public TutoShowcase setBindingContentView(@LayoutRes int content) {
ViewDataBinding binding = DataBindingUtil.inflate(LayoutInflater.from(tutoView.getContext()), content, container, false);
container.addView(binding.getRoot(), ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
return this;
}

public void dismiss() {
ViewCompat.animate(container)
.alpha(0f)
Expand Down