From 3a0187ae0b38f4f4bbdf80c0a207f808262e8e32 Mon Sep 17 00:00:00 2001 From: Teodor Grigor Date: Wed, 7 Oct 2020 23:04:59 +0100 Subject: [PATCH 1/3] created setTextAlignment method --- .../com/zeoflow/stylar/sample/MainActivity.java | 8 ++++++-- .../com/zeoflow/stylar/view/StylarView.java | 17 +++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/sample/src/main/java/com/zeoflow/stylar/sample/MainActivity.java b/sample/src/main/java/com/zeoflow/stylar/sample/MainActivity.java index 6080ab3..95bec82 100644 --- a/sample/src/main/java/com/zeoflow/stylar/sample/MainActivity.java +++ b/sample/src/main/java/com/zeoflow/stylar/sample/MainActivity.java @@ -2,6 +2,7 @@ import android.graphics.Color; import android.os.Bundle; +import android.view.Gravity; import android.widget.Toast; import androidx.annotation.NonNull; @@ -13,6 +14,7 @@ import com.zeoflow.stylar.core.StylarTheme; import com.zeoflow.stylar.view.StylarView; +import static com.zeoflow.stylar.view.StylarView.ALIGNMENT_LEFT; import static com.zeoflow.utils.FileUtil.readFile; public class MainActivity extends ActivityCore @@ -48,9 +50,11 @@ public void configureTheme(@NonNull StylarTheme.Builder builder) .build(); stylar.setMarkdown(accClosed); - stylar.setMarkdown(readFile(getAssets(), "content.txt", "\n\n")); + stylarView.setTextAlignment(ALIGNMENT_LEFT); - logger(stylarView.getText()); +// stylar.setMarkdown(readFile(getAssets(), "content.txt", "\n\n")); + +// logger(stylarView.getText()); } diff --git a/stylar/src/main/java/com/zeoflow/stylar/view/StylarView.java b/stylar/src/main/java/com/zeoflow/stylar/view/StylarView.java index 05a6e84..a53fa2a 100644 --- a/stylar/src/main/java/com/zeoflow/stylar/view/StylarView.java +++ b/stylar/src/main/java/com/zeoflow/stylar/view/StylarView.java @@ -2,7 +2,9 @@ import android.content.Context; import android.util.AttributeSet; +import android.view.Gravity; import android.view.LayoutInflater; +import android.view.View; import android.widget.FrameLayout; import android.widget.ScrollView; import android.widget.TextView; @@ -69,6 +71,21 @@ public String getText() return String.valueOf(this.mtvTextView.getText()); } + public static String ALIGNMENT_LEFT = "left"; + public static String ALIGNMENT_CENTER = "center"; + public static String ALIGNMENT_RIGHT = "right"; + + public void setTextAlignment(String alignment) + { + if (alignment.equals(ALIGNMENT_LEFT)) { + this.mtvTextView.setGravity(View.TEXT_ALIGNMENT_TEXT_START); + } else if (alignment.equals(ALIGNMENT_CENTER)) { + this.mtvTextView.setGravity(View.TEXT_ALIGNMENT_CENTER); + } else if (alignment.equals(ALIGNMENT_RIGHT)) { + this.mtvTextView.setGravity(View.TEXT_ALIGNMENT_TEXT_END); + } + } + public TextView getMtvTextView() { return this.mtvTextView; From 149ea6c727aa17a342552b9851ff5b09b1a02889 Mon Sep 17 00:00:00 2001 From: Teodor Grigor Date: Wed, 7 Oct 2020 23:13:14 +0100 Subject: [PATCH 2/3] fixed unknown gravity --- .../src/main/java/com/zeoflow/stylar/view/StylarView.java | 6 +++--- stylar/src/main/res/layout/stylar_text_view.xml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/stylar/src/main/java/com/zeoflow/stylar/view/StylarView.java b/stylar/src/main/java/com/zeoflow/stylar/view/StylarView.java index a53fa2a..29d1c10 100644 --- a/stylar/src/main/java/com/zeoflow/stylar/view/StylarView.java +++ b/stylar/src/main/java/com/zeoflow/stylar/view/StylarView.java @@ -78,11 +78,11 @@ public String getText() public void setTextAlignment(String alignment) { if (alignment.equals(ALIGNMENT_LEFT)) { - this.mtvTextView.setGravity(View.TEXT_ALIGNMENT_TEXT_START); + mtvTextView.setGravity(Gravity.START); } else if (alignment.equals(ALIGNMENT_CENTER)) { - this.mtvTextView.setGravity(View.TEXT_ALIGNMENT_CENTER); + mtvTextView.setGravity(Gravity.CENTER); } else if (alignment.equals(ALIGNMENT_RIGHT)) { - this.mtvTextView.setGravity(View.TEXT_ALIGNMENT_TEXT_END); + mtvTextView.setGravity(Gravity.END); } } diff --git a/stylar/src/main/res/layout/stylar_text_view.xml b/stylar/src/main/res/layout/stylar_text_view.xml index 6f2feb9..c5cf652 100644 --- a/stylar/src/main/res/layout/stylar_text_view.xml +++ b/stylar/src/main/res/layout/stylar_text_view.xml @@ -17,6 +17,6 @@ android:background="#ffffff" android:fontFamily="@font/zeoflow_normal" android:padding="5dp" - android:textAlignment="center" /> + android:gravity="center" /> \ No newline at end of file From b8469f201292dd5dbb56f673e7ad33473befb0d2 Mon Sep 17 00:00:00 2001 From: Teodor Grigor Date: Wed, 7 Oct 2020 23:21:04 +0100 Subject: [PATCH 3/3] up version --- build.gradle | 14 ++------------ .../com/zeoflow/stylar/sample/MainActivity.java | 2 +- stylar/gradle.properties | 8 ++++++-- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/build.gradle b/build.gradle index db8cb53..39846e8 100644 --- a/build.gradle +++ b/build.gradle @@ -41,17 +41,7 @@ ext { buildToolsVersion = '30.0.1' minSdkVersion = 21 targetSdkVersion = 30 - versionCode = 2 - versionName = "1.0.1" + versionCode = 3 + versionName = "1.1.0" ndk = "21.3.6528147" - - ANNOTATIONS = 'org.jetbrains:annotations-java5:17.0.0' - - IX_JAVA = 'com.github.akarnokd:ixjava:1.0.0' - COMMONS_IO = 'commons-io:commons-io:2.6' - GOOGLE_JAVA_FORMAT = 'com.google.googlejavaformat:google-java-format:1.6' - GSON = 'com.google.code.gson:gson:2.8.5' - JSON_UNIT = 'net.javacrumbs.json-unit:json-unit:2.0.0.RC1' - - JUNIT = 'junit:junit:4.12' } \ No newline at end of file diff --git a/sample/src/main/java/com/zeoflow/stylar/sample/MainActivity.java b/sample/src/main/java/com/zeoflow/stylar/sample/MainActivity.java index 95bec82..2f923de 100644 --- a/sample/src/main/java/com/zeoflow/stylar/sample/MainActivity.java +++ b/sample/src/main/java/com/zeoflow/stylar/sample/MainActivity.java @@ -50,7 +50,7 @@ public void configureTheme(@NonNull StylarTheme.Builder builder) .build(); stylar.setMarkdown(accClosed); - stylarView.setTextAlignment(ALIGNMENT_LEFT); +// stylarView.setTextAlignment(ALIGNMENT_LEFT); // stylar.setMarkdown(readFile(getAssets(), "content.txt", "\n\n")); diff --git a/stylar/gradle.properties b/stylar/gradle.properties index 62c38d3..7eb79d1 100644 --- a/stylar/gradle.properties +++ b/stylar/gradle.properties @@ -1,9 +1,11 @@ POM_NAME=Stylar POM_ARTIFACT_ID=stylar POM_PACKAGING=aar -VERSION_NAME=1.0.1 -VERSION_CODE=2 + +VERSION_NAME=1.1.0 +VERSION_CODE=3 GROUP=com.zeoflow + POM_DESCRIPTION=An Android markdown library - it does not require WebView POM_URL=https://github.com/zeoflow/stylar POM_SCM_URL=https://github.com/zeoflow/stylar @@ -14,7 +16,9 @@ POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt POM_LICENCE_DIST=repo POM_DEVELOPER_ID=zeoflow POM_DEVELOPER_NAME=ZeoFlow + org.gradle.daemon=true + NEXUS_USERNAME= NEXUS_PASSWORD= signing.keyId=