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

Add background dialog support #44

Open
wants to merge 2 commits 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
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ public class Constants {

public static int DEFAULT_COLOR_TEXTVIEW_INFO = 0xFF000000;

public static int DEFAULT_COLOR_DIALOG = 0x00000000;

public static int DEFAULT_DOT_SIZE = 55;

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import android.graphics.PorterDuffXfermode;
import android.os.Build;
import android.os.Handler;
import android.support.v7.widget.CardView;
import android.util.AttributeSet;
import android.util.Log;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.LayoutInflater;
Expand Down Expand Up @@ -202,6 +202,8 @@ public class MaterialIntroView extends RelativeLayout {
* if this is true
*/
private boolean isPerformClick;
private CardView cardViewDialog;
private int colorBackgroundDialog;

public MaterialIntroView(Context context) {
super(context);
Expand Down Expand Up @@ -236,6 +238,7 @@ private void init(Context context) {
fadeAnimationDuration = Constants.DEFAULT_FADE_DURATION;
padding = Constants.DEFAULT_TARGET_PADDING;
colorTextViewInfo = Constants.DEFAULT_COLOR_TEXTVIEW_INFO;
colorBackgroundDialog = Constants.DEFAULT_COLOR_DIALOG;
focusType = Focus.ALL;
focusGravity = FocusGravity.CENTER;
isReady = false;
Expand All @@ -262,6 +265,9 @@ private void init(Context context) {
View layoutInfo = LayoutInflater.from(getContext()).inflate(R.layout.material_intro_card, null);

infoView = layoutInfo.findViewById(R.id.info_layout);
cardViewDialog = (CardView) layoutInfo.findViewById(R.id.card_view);
cardViewDialog.setCardBackgroundColor(colorBackgroundDialog);
// cardViewDialog.setBackgroundColor(colorBackgroundDialog);
textViewInfo = (TextView) layoutInfo.findViewById(R.id.textview_info);
textViewInfo.setTextColor(colorTextViewInfo);
imageViewIcon = (ImageView) layoutInfo.findViewById(R.id.imageview_icon);
Expand Down Expand Up @@ -561,6 +567,12 @@ private void setColorTextViewInfo(int colorTextViewInfo) {
textViewInfo.setTextColor(this.colorTextViewInfo);
}

private void setDialogBackgroundColor(int colorBackgroundDialog) {
this.colorBackgroundDialog = colorBackgroundDialog;
cardViewDialog.setCardBackgroundColor(this.colorBackgroundDialog);
// cardViewDialog.setBackgroundColor(this.colorBackgroundDialog);
}

private void setTextViewInfo(String textViewInfo) {
this.textViewInfo.setText(textViewInfo);
}
Expand Down Expand Up @@ -664,6 +676,11 @@ public Builder setTextColor(int textColor) {
return this;
}

public Builder setDialogBackgroundColor(int color) {
materialIntroView.setDialogBackgroundColor(color);
return this;
}

public Builder setInfoText(String infoText) {
materialIntroView.enableInfoDialog(true);
materialIntroView.setTextViewInfo(infoText);
Expand Down