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

Feature/configurable table odd row alpha #354

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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

# 4.6.3
#### Added
* `ext-tables` - `TableTheme.tableOddRowBackgroundColorAplha` which gives ability to change
alpha channel of table odd rows


# 4.6.2

#### Added
Expand Down
8 changes: 4 additions & 4 deletions app-sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ android {

// do not sign in CI
if (!project.hasProperty('CI')) {
signingConfigs {
/*signingConfigs {
config {

final def keystoreFile = project.file('keystore.jks')
Expand Down Expand Up @@ -89,14 +89,14 @@ android {
keyAlias project[keystoreAlias]
keyPassword project[keystoreAliasPassword]
}
}
}*/

buildTypes {
debug {
signingConfig signingConfigs.config
// signingConfig signingConfigs.config
}
release {
signingConfig signingConfigs.config
// signingConfig signingConfigs.config
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ android.enableJetifier=true
android.enableBuildCache=true
android.buildCacheDir=build/pre-dex-cache

VERSION_NAME=4.6.2
VERSION_NAME=4.6.3

GROUP=io.noties.markwon
POM_DESCRIPTION=Markwon markdown for Android
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ public static Builder emptyBuilder() {
// by default paint.color * TABLE_ODD_ROW_DEF_ALPHA
protected final int tableOddRowBackgroundColor;

// by default TABLE_ODD_ROW_DEF_ALPHA
protected int tableOddRowBackgroundColorAlpha;

// @since 1.1.1
// by default no background
protected final int tableEvenRowBackgroundColor;
Expand All @@ -62,6 +65,12 @@ protected TableTheme(@NonNull Builder builder) {
this.tableOddRowBackgroundColor = builder.tableOddRowBackgroundColor;
this.tableEvenRowBackgroundColor = builder.tableEvenRowBackgroundColor;
this.tableHeaderRowBackgroundColor = builder.tableHeaderRowBackgroundColor;

if(builder.tableOddRowBackgroundColorAlpha == -1) {
this.tableOddRowBackgroundColorAlpha = TABLE_ODD_ROW_DEF_ALPHA;
} else {
this.tableOddRowBackgroundColorAlpha = builder.tableOddRowBackgroundColorAlpha;
}
}

/**
Expand Down Expand Up @@ -109,7 +118,8 @@ public void applyTableBorderStyle(@NonNull Paint paint) {
public void applyTableOddRowStyle(@NonNull Paint paint) {
final int color;
if (tableOddRowBackgroundColor == 0) {
color = ColorUtils.applyAlpha(paint.getColor(), TABLE_ODD_ROW_DEF_ALPHA);

color = ColorUtils.applyAlpha(paint.getColor(), tableOddRowBackgroundColorAlpha);
} else {
color = tableOddRowBackgroundColor;
}
Expand Down Expand Up @@ -140,6 +150,7 @@ public static class Builder {
private int tableBorderColor;
private int tableBorderWidth = -1;
private int tableOddRowBackgroundColor;
private int tableOddRowBackgroundColorAlpha = -1;
private int tableEvenRowBackgroundColor; // @since 1.1.1
private int tableHeaderRowBackgroundColor; // @since 1.1.1

Expand Down Expand Up @@ -167,6 +178,12 @@ public Builder tableOddRowBackgroundColor(@ColorInt int tableOddRowBackgroundCol
return this;
}

@NonNull
public Builder tableOddRowBackgroundColorAlpha(int tableOddRowBackgroundColorAlpha) {
this.tableOddRowBackgroundColorAlpha = tableOddRowBackgroundColorAlpha;
return this;
}

@NonNull
public Builder tableEvenRowBackgroundColor(@ColorInt int tableEvenRowBackgroundColor) {
this.tableEvenRowBackgroundColor = tableEvenRowBackgroundColor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public int tableBorderWidth(@NonNull Paint paint) {
@ColorInt
public int tableOddRowBackgroundColor(@NonNull Paint paint) {
return tableOddRowBackgroundColor == 0
? ColorUtils.applyAlpha(paint.getColor(), TABLE_ODD_ROW_DEF_ALPHA)
? ColorUtils.applyAlpha(paint.getColor(), tableOddRowBackgroundColorAlpha)
: tableOddRowBackgroundColor;
}

Expand Down