Skip to content

Commit

Permalink
Version 2.0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoscgdev committed Aug 4, 2019
1 parent 06d8ac1 commit d1ad489
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 31 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ android {
applicationId "com.marcoscg.dialogsheetsample"
minSdkVersion 14
targetSdkVersion 28
versionCode 206
versionName "2.0.6"
versionCode 207
versionName "2.0.7"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
23 changes: 8 additions & 15 deletions app/src/main/java/com/marcoscg/dialogsheetsample/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,12 @@ protected void onCreate(Bundle savedInstanceState) {
findViewById(R.id.button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {

createAndShowDialog();

}
});
}

private void createAndShowDialog() {

DialogSheet dialogSheet = new DialogSheet(MainActivity.this)
.setTitle(R.string.app_name)
.setMessage(R.string.lorem)
Expand All @@ -46,9 +43,7 @@ public void onClick(View view) {
.setNegativeButton(android.R.string.cancel, null)
.setNeutralButton("Neutral", null);


if (((AppCompatCheckBox)findViewById(R.id.customViewCheckBox)).isChecked()) {

if (((AppCompatCheckBox) findViewById(R.id.customViewCheckBox)).isChecked()) {
dialogSheet.setView(R.layout.custom_dialog_view);

// Access dialog custom inflated view
Expand All @@ -62,14 +57,13 @@ public void onClick(View view) {
});
}

if (!((AppCompatCheckBox)findViewById(R.id.cornersCheckBox)).isChecked())
if (!((AppCompatCheckBox) findViewById(R.id.cornersCheckBox)).isChecked())
dialogSheet.setRoundedCorners(false);

if (((AppCompatCheckBox)findViewById(R.id.iconCheckBox)).isChecked())
if (((AppCompatCheckBox) findViewById(R.id.iconCheckBox)).isChecked())
dialogSheet.setIconResource(R.mipmap.ic_launcher);

dialogSheet.show();

}

@Override
Expand All @@ -80,12 +74,11 @@ public boolean onCreateOptionsMenu(Menu menu) {

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_github:
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/marcoscgdev/DialogSheet")));
return true;
default:
return super.onOptionsItemSelected(item);
if (item.getItemId() == R.id.action_github) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/marcoscgdev/DialogSheet")));
return true;
}

return super.onOptionsItemSelected(item);
}
}
4 changes: 2 additions & 2 deletions dialogsheet/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ android {
defaultConfig {
minSdkVersion 14
targetSdkVersion 28
versionCode 206
versionName "2.0.6"
versionCode 207
versionName "2.0.7"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

}
Expand Down
24 changes: 12 additions & 12 deletions dialogsheet/src/main/java/com/marcoscg/dialogsheet/DialogSheet.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ public DialogSheet setIconResource(@DrawableRes int icon) {
}

/**
* @deprecated use {@link #setIconDrawable(Drawable)} instead.
* @param icon
* @return
* @deprecated use {@link #setIconDrawable(Drawable)} instead.
*/
@Deprecated
public DialogSheet setIcon(Drawable icon) {
Expand All @@ -136,9 +136,9 @@ public DialogSheet setIcon(Drawable icon) {
}

/**
* @deprecated use {@link #setIconBitmap(Bitmap)} instead.
* @param icon
* @return
* @deprecated use {@link #setIconBitmap(Bitmap)} instead.
*/
@Deprecated
public DialogSheet setIcon(Bitmap icon) {
Expand All @@ -148,9 +148,9 @@ public DialogSheet setIcon(Bitmap icon) {
}

/**
* @deprecated use {@link #setIconResource(int)} instead.
* @param iconRes
* @return
* @deprecated use {@link #setIconResource(int)} instead.
*/
@Deprecated
public DialogSheet setIcon(@DrawableRes int iconRes) {
Expand Down Expand Up @@ -383,9 +383,9 @@ public View getInflatedView() {
}

public void show() {
if (backgroundColor==0)
if (backgroundColor == 0)
backgroundColor = Utils.getAttrColor(context, android.R.attr.windowBackground);
if (backgroundColor!=0) {
if (backgroundColor != 0) {
Drawable bgDrawable = null;
View bgView = bottomSheetDialog.findViewById(R.id.mainDialogContainer);
if (bgView != null)
Expand All @@ -395,9 +395,9 @@ public void show() {
bgDrawable.setColorFilter(backgroundColor, PorterDuff.Mode.SRC_IN);
}

if (titleTextColor==0)
if (titleTextColor == 0)
titleTextColor = Utils.getTextColor(backgroundColor);
if (messageTextColor==0)
if (messageTextColor == 0)
messageTextColor = Utils.getTextColorSec(backgroundColor);

titleTextView.setTextColor(titleTextColor);
Expand All @@ -406,7 +406,7 @@ public void show() {
setColoredNavBar(coloredNavigationBar);

if (positiveButton.getVisibility() != View.VISIBLE)
((RelativeLayout.LayoutParams)negativeButton.getLayoutParams()).addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
((RelativeLayout.LayoutParams) negativeButton.getLayoutParams()).addRule(RelativeLayout.ALIGN_PARENT_RIGHT);

if (!areButtonsVisible()) {
int bottomPadding = 0;
Expand All @@ -419,11 +419,11 @@ public void show() {
topPadding = dpToPx(24);
}

textContainer.setPadding(0,topPadding,0, bottomPadding);
textContainer.setPadding(0, topPadding, 0, bottomPadding);
} else {
if ((titleTextView.getText() == null || TextUtils.isEmpty(titleTextView.getText()))
&& messageTextView.getText() != null && !TextUtils.isEmpty(messageTextView.getText()))
textContainer.setPadding(0,dpToPx(24),0, 0);
textContainer.setPadding(0, dpToPx(24), 0, 0);
}

bottomSheetDialog.show();
Expand Down Expand Up @@ -486,7 +486,7 @@ private void setColoredNavBar(boolean coloredNavigationBar) {

if (Build.VERSION.SDK_INT >= 26) {
int flags = bottomSheetDialog.getWindow().getDecorView().getSystemUiVisibility();
flags &= ~View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
flags &= ~View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
bottomSheetDialog.getWindow().getDecorView().setSystemUiVisibility(flags);
}
}
Expand All @@ -499,7 +499,7 @@ private boolean areButtonsVisible() {
}

private void removePreviousMessageViews() {
for (int i=1; i < messageContainer.getChildCount(); i++) {
for (int i = 1; i < messageContainer.getChildCount(); i++) {
messageContainer.removeViewAt(i);
}
}
Expand Down

0 comments on commit d1ad489

Please sign in to comment.